WEEK11
#include <GL/glut.h>
void display(){
gultSolidTeapot
glutSwapBuffers();
}
void keyboard(unsigned char key, int x,int y){
if(key==27) exit(0);
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week11");
glutDisplayFunc(display);
glutKeyboardFunc(keyBoard);
glutMainLoop();
}
week11-2
#include <GL/glut.h>
void display(){
gultSolidTeapot
glutSwapBuffers();
}
void keyboard(unsigned char key, int x,int y){
if(key=='1') PlaySound(wav,);
if(key==',lik ;lllks lk lklxsslkj'jnlkcjnlaknlknlknlkcjskkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
zijl ;lj;j;osoc;aojp;lj;lj.lj;ljvjvk jkjb k zjocilllllllllllzl 孬ㄋbbbbbbbbbck kjsnkcjnkajnk,);
}
if(key=='1') PlaySound(wav,);
int main5(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week11");
glutDisplayFunc(display);
glutKeyboardFunc(keyBoard);
g
}
week11_3
#include <windows.h>
int main()
}
PlaySound("C:\\Users\\Adminstrator\\Desktop\\do_re_mi\\do.wav",NULL,SND_SYNC);
PlaySound("C:\\Users\\Adminstrator\\Desktop\\do_re_mi\\do.wav",NULL,SND_SYNC);
PlaySound("C:\\Users\\Adminstrator\\Desktop\\do_re_mi\\do.wav",NULL,SND_SYNC);
PlaySound("C:\\Users\\Adminstrator\\Desktop\\re_re_mi\\do.wav",NULL,SND_SYNC);
PlaySound("C:\\Users\\Adminstrator\\Desktop\\mi_re_mi\\do.wav",NULL,SND_SYNC);
}
playsound要一個咒語
setting-compiler..的linker setting要加上winm
把codeblocks重開
linker setting
以免程式會在瞬間結束
改成file-new-empty file空白檔案來示範
linker setting再加一個咒語 winmm即可
week11_4
#include "CMP3_MCL.h"
CMP3_MCT my,MP3;
int main(int argc,char*argv[]){
char filename[]=''';
myMP3.Play;
}
week11_5
Ctrl_S存檔
存檔後會變藍色
doremi檔案挪到門面
"."<Option>
will continue
<option >
.在CodeBlocks打開GLUT Project
~~~~~~~~~~
新GLUT Project->介紹mp3跟wav的差別
在NotePad++看,wav是RIFF,mp3是ID3
mp3不可以用PlaySoundA
+>#include <windows.h>和NULL,SND_ASYNC*
#include <windows.h>得在第一行 =>> 按123->do re mi
檔案Save everything,開week11-2_keyboard_wav_PlaySound的cbp檔(用NotePad++
第41行播音樂
開CodeBlocks,+新的檔案->要在Settings裡的Compiler-Linker Settings加"winmm"
開CodeBlocks+GLUT Project->播出mp3要加入"#include "CMP3_MCI.h"
CMP3_MCI.h複製到week11-4資料夾裡,音樂複製到doremi資料夾
開week11-4裡的cbp檔,改11行成"."
->mp3檔案複製放到week11-4
->freeglut的bin資料夾裡的dll檔複製拉到week11-4

沒有留言:
張貼留言