我正在尝试使用PlaySound,并且我将
#include <windows.h>
#include <mmsystem.h>
#pragma comment( lib, "Winmm.lib" )
using namespace std;
int main()
{
PlaySound(L"C:\\Users\\iD Student\\Downloads\\HarryPotter.mp3", 0, SND_FILENAME);
}它没有播放我想要的声音,而是播放了一些默认的Windows声音。
发布于 2017-07-28 02:04:40
PlaySound不支持.mp3文件。它只支持.wav文件。
这是播放声音的简单代码:
#include <windows.h>
#include <mmsystem.h>
#pragma comment( lib, "Winmm.lib" )
using namespace std;
int main()
{
//Replace C:\\Users\\iD Student\\Downloads\\HarryPotter.wav with the location of your file
PlaySound(L"C:\\Users\\iD Student\\Downloads\\HarryPotter.wav", 0, SND_FILENAME);
}https://stackoverflow.com/questions/45357550
复制相似问题