Google:NeHe Lesson32
下載Lesson32最下面Visual c++的範例
解壓縮桌面\Lesson32\lesson32.exe
二 嵌入自己的程式碼
1
#include <mmsystem.h>//多媒體系統
void mouse(int button, int state, int x, int y){
PlaySound("C:\\Users\\user\\Desktop\\lesson32/Data/shot.wav",NULL,SND_ASYNC);
}
glutMouseFunc(mouse);
2
void keyboard(unsigned char key, int x, int y)
{if(key=='1') PlaySound("MachineGun.wav",NULL,SND_ASYNC);
if(key=='2') PlaySound("xm1014-1.wav",NULL,SND_ASYNC);
if(key=='3') PlaySound("UZI",NULL,SND_ASYNC);
}
glutKeyboardFunc(keyboard);修改成設定的keyboard
下載的wav檔案,要放進freeglut內的bin資料夾內
3
去FB社團內載CMP3_MCI.h檔案並放進codeblacks的專案裡
程式碼:#include <mmsystem.h>
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
myMP3.Load("C:\\Users\\user\\Desktop\\yukai.mp3"); /// "C:/dropbox/yukai.mp3"
myMP3.Play();
沒有留言:
張貼留言