Sound playback in C ++ ... However, the game stops during sound playback ... how can I stop this lag?

Sound is created using:

PlaySound(TEXT("C:\\hitBrick.wav"), NULL, SND_FILENAME); 
+7
source share
1 answer

As already mentioned, Ville Krumlinde , use SND_ASYNC as follows:

 PlaySound(TEXT("C:\hitBrick.wav"), NULL, SND_FILENAME | SND_ASYNC); 

Take a look: http://msdn.microsoft.com/en-us/library/windows/desktop/dd743680%28v=vs.85%29.aspx

SND_ASYNC The sound is played asynchronously, and PlaySound returns immediately after the sound starts. To interrupt the asynchronous beep, call PlaySound with pszSound set to NULL.

+11
source

All Articles