public override ISample?GetSample(ISampleInfo sampleInfo) { IEnumerable <string> lookupNames; if (sampleInfo is HitSampleInfo hitSample) { lookupNames = getLegacyLookupNames(hitSample); } else { lookupNames = sampleInfo.LookupNames.SelectMany(getFallbackNames); } foreach (string lookup in lookupNames) { var sample = Samples?.Get(lookup); if (sample != null) { return(sample); } } return(null); }
public ISample GetSample(ISampleInfo sampleInfo) { if (provider.AllowSampleLookup(sampleInfo)) { return(skin.GetSample(sampleInfo)); } return(null); }
protected override bool AllowSampleLookup(ISampleInfo sampleInfo) { if (beatmapSkins == null) { throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed."); } return(sampleInfo is StoryboardSampleInfo || beatmapHitsounds.Value); }
public override ISample GetSample(ISampleInfo sampleInfo) { if (sampleInfo is HitSampleInfo hitSampleInfo) { return(Source.GetSample(new LegacyTaikoSampleInfo(hitSampleInfo))); } return(base.GetSample(sampleInfo)); }
public PoolableSkinnableSample GetPooledSample(ISampleInfo sampleInfo) { if (!samplePools.TryGetValue(sampleInfo, out var existingPool)) { AddInternal(samplePools[sampleInfo] = existingPool = new DrawableSamplePool(sampleInfo, 1)); } return(existingPool.Get()); }
public override ISample GetSample(ISampleInfo sampleInfo) { // layered hit sounds never play in mania if (sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample && legacySample.IsLayered) { return(new SampleVirtual()); } return(base.GetSample(sampleInfo)); }
public override SampleChannel GetSample(ISampleInfo sampleInfo) { if (sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy && legacy.CustomSampleBank == 0) { // When no custom sample bank is provided, always fall-back to the default samples. return(null); } return(base.GetSample(sampleInfo)); }
private DrawablePool <PoolableSkinnableSample> prepareSamplePool(ISampleInfo sampleInfo) { if (samplePools.TryGetValue(sampleInfo, out var pool)) { return(pool); } AddInternal(samplePools[sampleInfo] = pool = new DrawableSamplePool(sampleInfo, 1)); return(pool); }
public SampleChannel GetSample(ISampleInfo sampleInfo) { SampleChannel sourceChannel; if (beatmapHitsounds.Value && (sourceChannel = skin?.GetSample(sampleInfo)) != null) { return(sourceChannel); } return(fallbackSource?.GetSample(sampleInfo)); }
public SampleChannel GetSample(ISampleInfo sampleInfo) { SampleChannel sourceChannel; if (AllowSampleLookup(sampleInfo) && (sourceChannel = skin?.GetSample(sampleInfo)) != null) { return(sourceChannel); } return(fallbackSource?.GetSample(sampleInfo)); }
public ISample?GetSample(ISampleInfo sampleInfo) { foreach (string?lookup in sampleInfo.LookupNames) { ISample?sample = samples.Get(lookup); if (sample != null) { return(sample); } } return(null); }
public override ISample GetSample(ISampleInfo sampleInfo) { foreach (var lookup in sampleInfo.LookupNames) { var sample = resources.AudioManager.Samples.Get(lookup); if (sample != null) { return(sample); } } return(null); }
public ISample GetSample(ISampleInfo sampleInfo) { foreach (var skin in SkinSources) { ISample sourceSample; if ((sourceSample = disableableSkinSources[skin]?.GetSample(sampleInfo)) != null) { return(sourceSample); } } return(fallbackSource?.GetSample(sampleInfo)); }
public virtual SampleChannel GetSample(ISampleInfo sampleInfo) { if (!(sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample)) { return(Source.GetSample(sampleInfo)); } var playLayeredHitSounds = GetConfig <GlobalSkinConfiguration, bool>(GlobalSkinConfiguration.LayeredHitSounds); if (legacySample.IsLayered && playLayeredHitSounds?.Value == false) { return(new SampleChannelVirtual()); } return(Source.GetSample(sampleInfo)); }
public virtual Sample GetSample(ISampleInfo sampleInfo) { if (!(sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample)) { return(Source.GetSample(sampleInfo)); } var playLayeredHitSounds = GetConfig <LegacySetting, bool>(LegacySetting.LayeredHitSounds); if (legacySample.IsLayered && playLayeredHitSounds?.Value == false) { return(new SampleVirtual()); } return(Source.GetSample(sampleInfo)); }
/// <summary> /// Applies an <see cref="ISampleInfo"/> that describes the sample to retrieve. /// Only one <see cref="ISampleInfo"/> can ever be applied to a <see cref="PoolableSkinnableSample"/>. /// </summary> /// <param name="sampleInfo">The <see cref="ISampleInfo"/> to apply.</param> /// <exception cref="InvalidOperationException">If an <see cref="ISampleInfo"/> has already been applied to this <see cref="PoolableSkinnableSample"/>.</exception> public void Apply(ISampleInfo sampleInfo) { if (this.sampleInfo != null) { throw new InvalidOperationException($"A {nameof(PoolableSkinnableSample)} cannot be applied multiple {nameof(ISampleInfo)}s."); } this.sampleInfo = sampleInfo; Volume.Value = sampleInfo.Volume / 100.0; if (LoadState >= LoadState.Ready) { updateSample(); } }
private SampleChannel loadChannel(ISampleInfo info, Func <string, SampleChannel> getSampleFunction) { foreach (var lookup in info.LookupNames) { var ch = getSampleFunction($"Gameplay/{lookup}"); if (ch == null) { continue; } ch.Volume.Value = info.Volume / 100.0; return(ch); } return(null); }
public ISample GetSample(ISampleInfo sampleInfo, bool fallback) { ISample sourceChannel; if (AllowSampleLookup(sampleInfo) && (sourceChannel = skin?.GetSample(sampleInfo)) != null) { return(sourceChannel); } if (!fallback) { return(null); } return(fallbackSource?.GetSample(sampleInfo)); }
public override SampleChannel GetSample(ISampleInfo sampleInfo) { foreach (var lookup in sampleInfo.LookupNames) { var sample = Samples.Get(getFallbackName(lookup)); if (sample != null) { return(sample); } } if (sampleInfo is HitSampleInfo hsi) { // Try fallback to non-bank samples. return(Samples.Get(hsi.Name)); } return(null); }
private async void AcquireClick(object sender, RoutedEventArgs e) { if (_clientContext == null) { await ConnectAsync(); } ICollectionResult <IInstrumentInfo> instruments = await _clientContext.GetInstrumentsAsync(); IInstrumentInfo instrument = instruments.Items.First(); ISampleInfo sampleInfo = await _clientContext.AcquireSampleAsync(instrument.Id, new ExtendedSampleAcquisitionOptions { DarkSampleOptions = DarkSampleOptions.NewDark, IntegrationTime = TimeSpan.Parse(IntegrationTimeTextBox.Text), LaserPower = int.Parse((string)((ComboBoxItem)LaserPowerComboBox.SelectedItem).Content), SampleAverageCount = int.Parse(AverageSamplesText.Text) }); _computationDependencies = await _clientContext.GetComputationDependencyInfoAsync(instrument.Id, sampleInfo); UpdatePlot(); }
public ISample GetSample(ISampleInfo sampleInfo) => null;
public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
public SampleChannel GetSample(ISampleInfo sampleInfo) => null;
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public SkinnableSound(ISampleInfo hitSamples) : this(new[] { hitSamples }) { }
/// <summary> /// Creates a new <see cref="PoolableSkinnableSample"/> with an applied <see cref="ISampleInfo"/>. /// </summary> /// <param name="sampleInfo">The <see cref="ISampleInfo"/> to attach.</param> public PoolableSkinnableSample(ISampleInfo sampleInfo) : this() { Apply(sampleInfo); }
public override ISample GetSample(ISampleInfo sampleInfo) => null;
public SampleChannel GetSample(ISampleInfo sampleInfo) => CurrentSkin.Value.GetSample(sampleInfo);
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
public LegacyTaikoSampleInfo(ISampleInfo source) { this.source = source; }