#include <iostream>
using namespace std;
#include<graphics.h>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")
void BGM()
{
mciSendString(L"open ./xxxx.mp3 alias bgm",0,0,0);
mciSendString(L"play bgm",0,0,0);
mciSendString(L"setaudio bgm volume to 100", 0, 0, 0);//是设置的音量值
cout<<"volume to 100"<<endl;
system("pause");
mciSendString(L"setaudio bgm volume to 300", 0, 0, 0);//是设置的音量值
cout<<"volume to 300"<<endl;
system("pause");
mciSendString(L"setaudio bgm volume to 500", 0, 0, 0);//是设置的音量值
cout<<"volume to 500"<<endl;
system("pause");
mciSendString(L"setaudio bgm volume to 800", 0, 0, 0);//是设置的音量值
cout<<"volume to 800"<<endl;
system("pause");
mciSendString(L"setaudio bgm volume to 1000", 0, 0, 0);//是设置的音量值
cout<<"volume to 1000"<<endl;
system("pause");
}
int main()
{
BGM();
system("pause");
return 0;
}
试一试音量调节,成功!!!
于 2022-06-20 19:41:38 首次发布