This project has moved. For the latest updates, please go here.

Bug in WaveOut when using mme and callback functions

Dec 30, 2009 at 9:31 PM

The Stop method of WaveOut will hang on the waveOutReset(hWaveOut) call when using a callback function. This is because in the callback function it tries to queue another buffer which attempts to lock waveOutLock - causing a deadlock. To resolve the problem, move the statement "playbackState = PlaybackState.Stopped" to before the "lock (waveOutLock)" statement in WaveOut.Stop().

Note: When calling waveOutReset queued buffers are returned during the call to waveOutReset. This is not a problem when using a callback window.

One other problem identified: If you intend using the SPEEX codec for playing back SPEEX encoded wave files, you may need to increase the default size of the extraData array in WaveFormatExtraData. The default size is 100 bytes but the codec I use requires more (120 works fine for me). This stops an array bounds exception that you would otherwise get.


Dec 31, 2009 at 11:09 AM

the waveOut hanging on Stop with function callbacks is a longstanding issue with certain audio chipsets (SoundMAX in particular). However, you may have run into another issue, so I will have a look into your suggestion when I get a chance.

also thanks for the SPEEX extra size suggestion. I'll look into that too.



Mar 25, 2010 at 3:00 PM

hi Matt69, I just had a chance to revisit this on a system that exhibits this problem and you are exactly right. I will check in your fix shortly