#include <mmsystem.h>
PlaySound("shot.wav", NULL, SND_ASYNC);
記得 bin 資料夾要用音檔
加入#include <windows.h> 因為mmsystem.h需要windows.h
去moodle載 CMP3_CMI.h
加入#include <CMP3_CMI.h> mp3的外掛
宣告變數
CMP3_MCI myMP3;
int a;
float b;
char c;
再寫程式
myMP3.Load("car.mp3"); 讀入mp3檔
myMP3.Play(); 播放

~~~~~~~~~~~~~~~~~~~~~~~~
timer
加入程式
void timer(int t)
{
glutTimerFunc(1000, timer, t+1);
PlaySound("shot.wav", NULL, SND_ASYNC);
}
沒有留言:
張貼留言