I\'m working on an app that plays audio continuously using the waveOut... API from winmm.dll. The app uses \"leapfrog\" buffers, which are basically a
The solution to this was very simple (thanks to Larry Osterman): replace the callback with a WndProc.
The waveOutOpen method can take either a delegate (for callback) or a window handle. I was using the delegate approach, which is apparently inherently prone to deadlocking (makes sense, especially in managed code). I was able to simply have my player class inherit from Control and override the WndProc method, and do the same stuff in this method that I was doing in the callback. Now I can call waveOutGetPosition forever and it never locks up.