【发布时间】:2025-12-28 13:45:12
【问题描述】:
我一直在测试声音,我注意到 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;
}
此代码播放声音,但它会等待输出“这个声音很酷”,直到声音播放完毕。我怎样才能让它不那样做?
【问题讨论】: