2018年5月7日 星期一

(未更改)week*11小紅帽槓上大野狼

1.聲音/ 音效.音樂
2.實作:PlaySound(),CMP3_MCI.h
3.鍵盤鋼琴.射擊遊戲
4.複習貼圖+TRRT.下周小考

*音檔
  -上網載wav音檔,放入freeglut/bin中
  -
*code
  -新增 #include <mmsystem.h>
  -在int main()函式中新增,PlaySound("檔名.wav",NULL,SND_ASYNC);
  -SND_SYNC要等、SND_ASYNC不要等(不同步)
*音檔打不開
  -喇叭播放位置不正確
  -
  -檔案名稱不正確
  -取消-隱藏已知檔案類型的副檔名
  -
*貝殼專案
  -選C
  -
#include <stdio.h>
#include <windows.h>
#include <mmsystem.h>
順序很重要

int main()
{
    PlaySound("ambul.wav",NULL,SND_SYNC);
    printf("Hello world!\n");
    return 0;
}
  -Build option-Linker settings-新增winmm
  -
  -音檔要抓到專案裡
  -
*程式碼
  -void mouse(int button,int state,int x,int y)
   {
        if(state==GLUT_DOWN) PlaySound(檔名.wav",NULL,SND_ASUNC);
   }mouseu要按下去,才發出聲音,如果沒有,按下去跟放開都會有聲音
不同步
  -
  -
  -要記得按Activate project,才能彈鋼琴
  -

沒有留言:

張貼留言