2016年5月3日 星期二

Week 11 邱芳妤


作業 1


1. 建立新的貝殼專案



2.下載 DO.RE.MI 的 WAV音檔






撰寫程式:

#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;
}




BUILD OPTION



Linker settings

ADD winmm


執行結果








作業 2


程式碼撰寫為

#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_SYNC);
    if(key=='2') PlaySoundA("Re.wav", NULL, SND_SYNC);
    if(key=='3') PlaySoundA("Mi.wav", NULL, SND_SYNC);
}
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;
}



 2.BUILD OPTION

    如圖加上咒語

   freeglut
   opengl32
   glu32
   gdi32
   winmm


新增來源資料夾 freeglut\include


freeglut\lib


執行結果




作業 3

課堂作業3

將MP3 檔及"CMP3_MCI"放入資料夾


撰寫程式碼


執行結果


沒有留言:

張貼留言