Click to See Complete Forum and Search --> : When does 'waveOutClose()' return?


Gyannea
April 22nd, 2003, 08:39 AM
According to Petzold, 'waveOutClose()' sends a MM_WOM_CLOSE message to the specified callback function. In his example, he then calls 'waveOutUnprepareHeader()' after receiving the MM_WOM_CLOSE message. According to the SDK, a call to 'waveOutClose()' invalidates the soundcard handle and returns a set of values, one being 'WAVER_STILLPLAYING'. If that value is returned, one is supposed to call 'waveOutReset()'.

In my callback function, when I am done filling and sending buffers, I call 'waveOutClose()' but the call never returns. Does someone know how this function works and what it does? Does it invalidate the handle, and if it does, how can one unprepare the header as in Petzold?

RockNix
April 23rd, 2003, 06:16 AM
the difference to petzold is - he handles wave-notification within his wndProc. that is a little different to handle notification from within a callback function like you did.

you MUST NOT call any other waveAPI functions from within your callback - this might cause a deadlock ( see MSDN) ...

instead you should synchronize a seperate thread by using events to be set from within your wave-callback.

hope it helps ...