STEP1:開CodeBlocks開新專案
Add libraries -> winmm
#include <stdio.h>
#include <mmsystem.h>
int main(int argc, char *argv[])
{
PlaySoundA("C:\\Users\\user\\Downloads\\lightning .wav", NULL, SND_ASYNC);
STEP2:製作鋼琴
程式碼:
#include <mmsystem.h>
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
void timer(int t)
{
glutTimerFunc(2000, timer, 0);
PlaySound("Shot.wav",NULL,SND_ASYNC);
}
int main(int argc, char *argv[])
{
//myMP3.Load("BOWZ.mp3");
//myMP3.Play();
//PlaySound("Shot.wav",NULL,SND_ASYNC);
glutInit(&argc, argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("GLUT Shapes");
glutReshapeFunc(resize);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutIdleFunc(idle);
glutTimerFunc(5000, timer, 0);
沒有留言:
張貼留言