2024年5月30日 星期四

05/30

 1.week15-1_PlaySound

    安裝freeglut,新增GLUT專案

    """cpp

        #include <windows.h>///第一行

    """ 

       PlaySound("檔名.wav",NULL,SND_ASYNC);///有A 不同步/不等待

    """

        PlaySound("C:/Do.wav",NULL,SND_SYNC);///沒有A 同步等待

        PlaySound("C:/Re.wav",NULL,SND_SYNC);

        PlaySound("C:/Mi.wav",NULL,SND_SYNC);

        PlaySound("C:/Fa.wav",NULL,SND_SYNC);

        PlaySound("C:/Sol.wav",NULL,SND_SYNC);

    """

    把前面註解PlaySound("C:/Do.wav",NULL,SND_SYNC);///沒有A 同步等待

        PlaySound("C:/Re.wav",NULL,SND_SYNC);

        PlaySound("C:/Mi.wav",NULL,SND_SYNC);

        PlaySound("C:/Fa.wav",NULL,SND_SYNC);

    改成

    """cpp

    static void key(unsigned char key, int x, int y)

{

    switch (key)

    {

        case '1':

            PlaySound("C:/Do.wav",NULL,SND_SYNC);

            break;

        case '2':

            PlaySound("C:/Re.wav",NULL,SND_SYNC);

            break;

        case '3':

            PlaySound("C:/Mi.wav",NULL,SND_SYNC);

            break;

}

    """

    現在要把工作執行目錄Project-Properties的第2分頁

    Execution working dir 改成小數點

    再把 桌面\freeglut\bin\freeglut.dll 及音樂,都copy到專案目錄

2.week15-2_PlaySound_empty

    新增GLUT專案

    把程式碼全刪

    """cpp

        #include <windows.h>

            int main()

            {

                PlaySound("C:/檔名.wav",NULL,SND_SYNC);

            }

    """

3.week15-3_CMP3_MCI

    新增專案

    請把CMP3_MCI.h和sone.mp3和freeglut.dll都放到你的專案目錄

    把你的工作執行目錄,設定成小數點

    """cpp

        #include "CMP._MCI.h",//雙引號,很像之前"glm.h"

        CMP3_MCI myMP3;//宣告一個物件變數

    """

    在main()

    """cpp

        int main(...)

        {

            myMP3.Load("song.mp3");

            myMP3.Play();

            ...

        }

    """

4.week15-4_mouse_motion_translate_rotate

    貼上11行GLUT程式

    用滑鼠移動



紀錄座標


轉動



沒有留言:

張貼留言