The problem is the SND_ASYNC
flag. It says that you want this call to return immediately and play the sound in background.
If you do this in a loop, since it will return with the sound still playing, it will overlap with the next call and do nothing, because IIRC, an application can only do one call to PlaySound at the same time.
The solution is to replace SND_ASYNC
with SND_SYNC
(or remove it, since it is the default). If you need the call to be asynchronous, you can create a thread and equeue the sounds you want to play. The thread will play synchronously, but your other threads won't notice.