I have a strange problem when doing recording and playback of audio at the same time under Windows7.
The problem can be described as follows:
The Win32 API knows a waveIn and a waveOut unit.
All functions that make some noise (e.g. PlaySound)
come sooner or later down to use the waveOut unit,
while all functions that do recording use at the lower end
the waveIn unit.
The problem I have is, that if the waveIn and the
waveOut unit run at the same time AND are operated
from different threads, the waveOut unit gets
occasionally blocked (e.g. hangs within the PlaySound() call) if at the same time the waveIn unit operates (means I am processing WIM_DATA Messages and do waveInUnprepare=>something=>waveInPrepare=>waveInAddBuffer).
This happens on ALL Windows7 machines and ALL soundcards, so it is NOT hardware or driver related. WindowsXP and Vista are working fine with the very same executable.
Speculation:
This problem is new in Windows7. Looks like they removed
some semaphore protection or something from winmm.dll.
However, it is too easy to point into Microsofts' direction.
I haven't found anything about this problem in the Internet,
where plenty of complains must arise if this is a bug in
Microsofts' winmm.dll code.
So i guess I must do something wrong on my end.
Do I need to put the code executed on WIM_DATA into a critical section and do the same for any PlaySound Call?
Any help or hint is very appreciated!