winmm: PlaySound SND_ASYNC fix

Vedran Rodic vrodic at
Mon May 28 09:38:29 CDT 2007

Hi, this patch is still not applied though I've submitted it last
Wednesday. I guess it's not obviously clear that it is correct, so I'm
asking for a review here. I've peronally tested it with alsa and oss
sound backends. It specifically fixes one series of Croatian child
educational games named "Suncica".

Detailed info:

Applications expect PlaySound() not to block when called with
SND_ASYNC flag. However, if a sound is currently playing, there is a
real chance of PlaySound() blocking for up to 1/3 of a second (size of
the playsound buffer), because of a sound buffer waiting to be played.
This patch adds a hWave field in the WINE_PLAYSOUND internal struct in
winemm.h so that MULTIMEDIA_PlaySound() function can call waveOutReset
when a sound is already playing to quickly remove it from the sound
system. Another scenario is when application wants to quickly  stop a
currently playing sound at a specific time. Blocking behaviour isn't
necessarily a problem for such applications, but playing the sound for
additional 300 miliseconds could be.

ChangeLog entry:
Vedran Rodic <vrodic at>
- fix PlaySound so it doesn't block when another sound is already playing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: playsound.diff
Type: text/x-diff
Size: 1396 bytes
Desc: not available
Url :

More information about the wine-devel mailing list