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

WaveIn.StopRecording hangs in Release mode, works fine in Debug mode

Jul 23, 2014 at 11:01 PM
Edited Jul 23, 2014 at 11:02 PM
I'm recording audio from my logitech webcam without any problems, but when I call WaveIn.StopRecording it hangs on
MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop");
In Debug mode this works fine and I can step on through the rest of the code.
the StopRecording call is made using the Dispatcher :
Dispatcher.Invoke(new Action(() => EnableAudioRecording(false)));
(Where EnableAudioRecording calls WaveIn.StopRecording)

Silly thing is that the NAudio Demo works just fine starting and stopping recording, also in release mode.
Am I missing something ? Are there any stupid things I shouldn't do that could cause this behaviour ?
Jul 28, 2014 at 4:29 PM
Check that no calls to waveIn methods happen on different threads. Some audio drivers can have issues with this.
You could also try WaveInEvent as an alternative if WaveIn isn;t working for you,.