コード例 #1
0
ファイル: SampleManager.cs プロジェクト: jorolf/osu-framework
        public AudioSample Get(string name)
        {
            lock (sampleCache)
            {
                AudioSample sample;
                if (sampleCache.TryGetValue(name, out sample))
                {
                    if (sample == null)
                    {
                        return(null);
                    }

                    //use existing bass sample (but provide a new audiosample instance).
                    sample = new AudioSampleBass(((AudioSampleBass)sample).SampleId);
                }
                else
                {
                    byte[] data = store.Get(name);
                    if (data != null)
                    {
                        sample = new AudioSampleBass(data);
                    }
                    sampleCache[name] = sample;
                }

                if (sample != null)
                {
                    AddItem(sample);
                }
                return(sample);
            }
        }
コード例 #2
0
        public AudioSample GetSample(string name)
        {
            byte[] data = store.Get(name);

            AudioSample sample = new AudioSampleBass(data);

            AddItem(sample);
            return(sample);
        }
コード例 #3
0
        public AudioSample Get(string name)
        {
            byte[] data = store.Get(name);

            if (data == null)
            {
                return(null);
            }

            AudioSample sample = new AudioSampleBass(data);

            AddItem(sample);
            return(sample);
        }