我一直在测试声音,我注意到它PlaySound
是阻塞的,即它会等到声音播放完毕才返回。
#include <iostream>
#include <Windows.h>
#include <mmsystem.h>
int main()
{
PlaySound("E:/Downloads/eb_sfx_archive/brainshock.wav", 0, SND_FILENAME);
std::cout << "this sound is cool";
Sleep (500);
std::cout << "\nmeh... not really";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
此代码播放声音,但它会等待输出“this sound is Cool”,直到声音播放完毕。我怎样才能让它不这样做呢?