PlaySound ,、MP3播放
計時器Timer
內插、線性內插、動畫
*老師小考講解
-

-

*把資料放在專案目錄裡面
-把原本放在freeglut\bin目錄中的資料,放在CodeBlocks的專案中
-把專案中的xxx.cbp,用notepad++更改working_dir,用小數點表示
-

*wav檔
-在 main 函式中加入 PlaySound( " xxx.wav " , NULL , SND_ASYNC );
-宣告 #include <mmsystem.h>
-

*mp3檔
-

-用上述方法無法打開mp3檔
-需要在 moodle / 課堂作業 / 載 CMP3_MIC.h / 放入 codeblocks 專案中
-

-在 main 函式中輸入 myMP3.Load( "xxx.mp3");
myMP3.Play();
-宣告 #include "CMP3_MCI.h"
-

*計時器Timer
-在 mian 函式中,加入glutTimerFunc( 4000 , timer , 0 ); //now:使用計時器,第一個鬧鐘,4秒
等多久 , 函式 , 參數
-此函式要在 glutCreatWindow();之後 glutMainLoop();之前
-

-宣告一個 void timer ( int t ) //now:計時器的函式
{
glutTimerFunc(2000, timer,0); // now:使用計時器,下一個鬧鐘,2秒
PlaySound("xxx.wav",NULL,SND_ASYNC);// now:
}
*內插公式:交插相乘
-

-


*內插程式
-

-

-

-

-

-

-

-

-

-
沒有留言:
張貼留言