程式碼:
#include <GL/glut.h>
#include <windows.h>
#include <mmsystem.h>
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
;
glutSwapBuffers();
}
void mouse(int button, int state, int x, int y)
{
if(state==GLUT_DOWN) PlaySoundA("oh-my-god-1.wav",NULL,SND_SYNC);
}
int main(int argc, char**argv)
{
myMP3.Load("TOKYO HOT THEME SONG ( FULL VERSION).mp3");
myMP3.play();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Week12 sound");
glutMouseFunc(mouse);
glutDisplayFunc(display);
glutMainLoop();
}



沒有留言:
張貼留言