2022年5月31日 星期二

Different Dimension Demon的契約書 week15

 step01

file-new-empty week15-1_PlaySound.cpp

#include<mmysystem.h>

#include<windows.h>

setting-compiler setting linker 加入winmm

```c

#include <windows.h>

#include <stdio.h>

int main()

{

    printf("PlaySound()之前\n");

    PlaySound("07042111.wav",NULL,SND_SYNC);

    printf("PlaySound()之後\n");

}

```


播do re mi

```c

#include <windows.h>

#include <stdio.h>

int main()

{

    PlaySound("do.wav",NULL,SND_SYNC);

    PlaySound("re.wav",NULL,SND_SYNC);

    PlaySound("mi.wav",NULL,SND_SYNC);

}

```


step02

1.ASYNC

```c

#include <windows.h>

#include <stdio.h>

int main()

{

    PlaySound("07042111.wav",NULL,SND_ASYNC);///ASYNC不等待

    while(1)

    {

        printf("請輸入數字: ");

        int N;

        scanf("%d",&N);

        if(N==1) PlaySound("do.wav",NULL,SND_ASYNC);

        if(N==2) PlaySound("re.wav",NULL,SND_ASYNC);

        if(N==3) PlaySound("mi.wav",NULL,SND_ASYNC);

    }

}

```


PlaySound()只能用wav檔

moodle下載CMP3_MCI.h放同目錄

#include "CMP3_MCI.h"

宣告CMP3_MCI.h

mp3load("檔名.mp3")

```c

#include <stdio.h>

#include "CMP3_MCI.h"

CMP3_MCI mp3;///宣告

int main()

{

    mp3.Load("07042111.mp3");

    mp3.Play();

    printf("隨便等你輸入數字,程式卡住了囉: ");

    int N;

    scanf("%d",&N);

}

```


拿上週的week14_angles_fprintf_fscanf

file-new-project,glut專案 week15_angles_TRT_again


step03

file-new-project,glut專案 week15_hw_gundam_parts.cbp

沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...