Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: Stop or Dispose methods hang if USB device undocked while playing wav file

$
0
0

Mark,

 

We have a version on the DLL of 1.5.3.0 and the following code causes the problem we have...

 

 

ManualResetEvent stopped = new ManualResetEvent(false);

 

private void playsound(string fileName)

{ 

 

  using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))

  {

 

 

 

 

 

 

 

  waveOut.PlaybackStopped += new EventHandler(waveOut_PlaybackHasStopped);

  waveOut.DeviceNumber = 0;

  waveOut.DesiredLatency = 200;

  waveOut.Init(inputStream);

  waveOut.Play(); 

 

  for (; ; )

 

 

      break;

    if (maxPlaySeconds > 0 && DateTime.Now.CompareTo(quitTime) >= 0)

     }

   }

 

  }

// DeadLock at this point. 

} 

 

 

private void waveOut_PlaybackHasStopped(object sender, EventArgs e)

{

  stop.Set();

}

 

 -mjl

    {

       break;

  { 

 

 

    if(stop.WaitOne(100))

Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>