Пример #1
0
        public void PlaySound(string fileName)
        {
            var input = new AudioFileReader(fileName);

            CachedSound cachedSound = null;

            if (!cachedSounds.TryGetValue(fileName, out cachedSound))
            {
                cachedSound = new CachedSound(fileName);
                cachedSounds.Add(fileName, cachedSound);
            }

            PlaySound(cachedSound);
        }
Пример #2
0
        public void PlaySound(string fileName, float volume = 1)
        {
            var input = new AudioFileReader(fileName);

            CachedSound cachedSound = null;

            if (!cachedSounds.TryGetValue(fileName, out cachedSound))
            {
                cachedSound = new CachedSound(fileName);
                cachedSounds.Add(fileName, cachedSound);
            }

            var resultingSampleProvider = new VolumeSampleProvider(new CachedSoundSampleProvider(cachedSound));

            resultingSampleProvider.Volume = volume;

            AddMixerInput(resultingSampleProvider);
        }
 public CachedSoundSampleProvider(CachedSound cachedSound)
 {
     this.cachedSound = cachedSound;
 }
Пример #4
0
 public void PlaySound(CachedSound sound)
 {
     AddMixerInput(new CachedSoundSampleProvider(sound));
 }