2024年5月30日 星期四

BK Week15

 # week15


# week15-1_PlaySound

0. 下載 freeglut 至桌面, 並解壓縮, 更改 lib 中的檔名

1. File-New-Project, GLUT專案 week15-1_PlaySound

2. 加入下方橘色部分程式碼

```cpp

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

    int ,main(......)

    {

        PlaySound("檔名.wav", NULL, SND_ASYNC);

    }

```

3. 執行後可以撥出音樂


# week15-2_PlaySound_empty

1. File-New-Project, GLUT專案 week15-2_PlaySound_empty

2. 把程式碼全刪

```cppˇ

    #include <windows.h>

int main()

{

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

}

```

3. 一樣可以放音樂

4. 先在把工作執行目錄 Project-Properties 的第2分頁 Execution working dir 改成小數點

5. 再把 桌面/freeglut/bin/freeglut.dll 和音樂 全部丟到檔案目錄


# week15-3_CMP3_MCI

1. File-New-Project, GLUT專案 week15-3_CMP3_MCI

2. 請把 CMP3 MCI.h 和 song.mp3 和 freeglut.dll 都放到專案目錄裡

3. 把工作執行目錄設成小數點

```cpp

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

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

```


```cpp

    int main(...)
    {

        myMP3.Load("song.mp3");

        myMP3.Play();

    }

```cpp


# week15-4_mouse_motion_translate_rotate

1. File-New-Project, GLUT專案 week15-4_mouse_motion_translate_rotate

2. 貼上 11行的 GLUT 程式碼

3. 目標先能 移動、旋轉、陣列

沒有留言:

張貼留言