Eric,
sharing a global variable between threads without proper sync protection or atomic operation is the wrong thing to do
Which one? bPlaySoundStop is set and reset within the scope of WINMM_cs.
Actually, there's one error: I should have put it at the exact same location of the Re/SetEvent(psStopEvent) it replaces, not outside the loop. This became apparent as I rethought of the scenario where 2 concurrent invocations of PlaySound need to interrupt an already running third one.
I'll resubmit ASAP.
moreover you're doing several unrelated changes in the same patch, please split up
I initially had that as 4-5 patches, then merged them for not being of significant value individually.
Regards, Jörg Höhle