コード例 #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);
            }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #10
0
        public SampleChannel GetSample(ISampleInfo sampleInfo)
        {
            SampleChannel sourceChannel;

            if (AllowSampleLookup(sampleInfo) && (sourceChannel = skin?.GetSample(sampleInfo)) != null)
            {
                return(sourceChannel);
            }

            return(fallbackSource?.GetSample(sampleInfo));
        }
コード例 #11
0
ファイル: ResourceStoreBackedSkin.cs プロジェクト: Wieku/osu
        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
ファイル: PoolableSkinnableSample.cs プロジェクト: H2n9/osu
        /// <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
ファイル: SkinnableSound.cs プロジェクト: Dijabolik/OSU-lism
        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
ファイル: MainPage.xaml.cs プロジェクト: MarqMetrix/Samples
        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
ファイル: TestSceneCatcher.cs プロジェクト: junho0118/osu
 public SampleChannel GetSample(ISampleInfo sampleInfo) =>
 throw new NotImplementedException();
コード例 #25
0
ファイル: SkinnableSound.cs プロジェクト: jason19659/osu
 public SkinnableSound(ISampleInfo hitSamples)
     : this(new[] { hitSamples })
 {
 }
コード例 #26
0
ファイル: PoolableSkinnableSample.cs プロジェクト: H2n9/osu
 /// <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
ファイル: SkinManager.cs プロジェクト: zzzzzz-812/osu
 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;
 }