示例#1
0
        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);
        }
示例#2
0
            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));
        }
示例#5
0
        public PoolableSkinnableSample GetPooledSample(ISampleInfo sampleInfo)
        {
            if (!samplePools.TryGetValue(sampleInfo, out var existingPool))
            {
                AddInternal(samplePools[sampleInfo] = existingPool = new DrawableSamplePool(sampleInfo, 1));
            }

            return(existingPool.Get());
        }
示例#6
0
        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));
        }
示例#8
0
        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);
        }
示例#9
0
        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));
        }
示例#11
0
        public ISample?GetSample(ISampleInfo sampleInfo)
        {
            foreach (string?lookup in sampleInfo.LookupNames)
            {
                ISample?sample = samples.Get(lookup);
                if (sample != null)
                {
                    return(sample);
                }
            }

            return(null);
        }
示例#12
0
        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);
        }
示例#13
0
        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));
        }
示例#14
0
        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));
        }
示例#15
0
        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));
        }
示例#16
0
        /// <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();
            }
        }
示例#17
0
        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);
        }
示例#18
0
        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));
        }
示例#19
0
        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);
        }
示例#20
0
        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();
        }
示例#21
0
 public ISample GetSample(ISampleInfo sampleInfo) => null;
示例#22
0
 public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
示例#23
0
 public SampleChannel GetSample(ISampleInfo sampleInfo) => null;
示例#24
0
 public SampleChannel GetSample(ISampleInfo sampleInfo) =>
 throw new NotImplementedException();
示例#25
0
 public SkinnableSound(ISampleInfo hitSamples)
     : this(new[] { hitSamples })
 {
 }
示例#26
0
 /// <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);
 }
示例#27
0
 public override ISample GetSample(ISampleInfo sampleInfo) => null;
示例#28
0
 public SampleChannel GetSample(ISampleInfo sampleInfo) => CurrentSkin.Value.GetSample(sampleInfo);
示例#29
0
 public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
示例#30
0
 public LegacyTaikoSampleInfo(ISampleInfo source)
 {
     this.source = source;
 }