2016年5月3日 星期二

Week11 林聖倫

(一).音效音樂
1.打開貝殼檔案

2.打上程式碼
#include <iostream>
#include <windows.h>
#include <mmsystem.h>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    PlaySoundA("Do.wav",NULL,SND_SYNC);
    PlaySoundA("Re.wav",NULL,SND_SYNC);
    PlaySoundA("Mi.wav",NULL,SND_SYNC);
    return 0;
}

3.在LINK打上winmm

4.下載DO RE MI

5.將下載的檔案 複製貼上到03161211

6.就可以執行了

(二)鍵盤
1.在咒語多打上Freeglut opengl32 glu32 gdi32 winmm

2.弄上include

3.弄上lib

4.打上程式碼
#include <GL/glut.h>
#include <windows.h>
#include <mmsystem.h>



void display()
{


}
void keyboard(unsigned char key,int x,int y)
{   if(key=='1') PlaySoundA("Do.wav",NULL,SND_ASYNC);
    if(key=='2') PlaySoundA("Re.wav",NULL,SND_ASYNC);
    if(key=='3') PlaySoundA("Mi.wav",NULL,SND_ASYNC);
}
int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("3D and sound");

    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);

    glutMainLoop();
    return 0;
}
12.執行

(三)整合 妖怪手表
1.把程式碼全部打上去


2.在把mp3放上去跟cmp3_mci上去

沒有留言:

張貼留言