Beispiel #1
0
 public static void Play(string mName)
 {
   if (!File.Exists(PATH + mName + EXT))
     return;
   audioFileReader = new AudioFileReader(PATH + mName + EXT);
   loop = new LoopStream(audioFileReader);
   volumeStream = new WaveChannel32(loop);
   volumeStream.Volume = muted ? volume : 0f;
   waveOutDevice = new WaveOut();
   waveOutDevice.Init(volumeStream);
   waveOutDevice.Play();
 }
Beispiel #2
0
 public static void Dispose()
 {
   if (waveOutDevice != null)
   {
     waveOutDevice.Stop();
     waveOutDevice.Dispose();
     waveOutDevice = null;
   }
   if (audioFileReader != null)
   {
     audioFileReader.Dispose();
     audioFileReader = null;
   }
   if (loop != null)
   {
     loop.Dispose();
     loop = null;
   }
 }