有谁熟悉playsound的帮下忙
出现的问题是:在menu1()函数中正常播放音乐,在按键后音乐关闭然后切换到menu2()后,不在播放下一个音乐
#include<Windows.h>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")
void menu1()
{
IMAGE img_bk,img_1,img_2;
static int speed=0;
loadimage(&img_bk,_T(".\\beats\\201038580_1.jpg"));
loadimage(&img_1,_T(".\\beats\\b1.bmp"));
loadimage(&img_2,_T(".\\beats\\b1_mask.bmp"));
putimage(0,0,&img_bk);
PlaySound (TEXT (".\\Blu - MitiS.wav"), NULL,SND_FILENAME| SND_ASYNC|SND_LOOP) ;
BeginBatchDraw();
while(1)
{
if(speed<=3000)
speed++;
if(speed==1)
putimage(0,0,&img_bk);
if(speed==1500)
{
putimage(210, 430, &img_2,SRCAND);
putimage(210, 430, &img_1,SRCINVERT);
}
if(speed==3000)
speed=0;
FlushBatchDraw();
if(kbhit())
{
PlaySound(0,0,SND_FILENAME);
break;
}
}
EndBatchDraw();
}
void menu2()
{ int op=0;
IMAGE img_1,img_2;
TCHAR s1[] =_T("Play");
TCHAR s2[]=_T("Write");
TCHAR s3[]=_T("Options");
TCHAR s4[]=_T("Exit");
settextcolor(WHITE);
settextstyle(16, 0, _T("黑体"));
MOUSEMSG m;
PlaySound (TEXT (".\\Fly - Ludovico Einaudi.wav"), NULL,SND_FILENAME| SND_ASYNC|SND_LOOP) ;
loadimage(&img_1,_T(".\\beats\\2-1.jpg"));
loadimage(&img_2,_T(".\\beats\\options.jpg"));
putimage(0,0,&img_1);
FlushBatchDraw();
while(1)
{
m = GetMouseMsg();
if((m.x>49&&m.x<89)&&(m.y>339&&m.y<409)&&op==0)
{
outtextxy(55,409,s1);
setlight();
FlushBatchDraw(48,339,92,430);
if(m.uMsg==WM_LBUTTONDOWN)
{
flag_m=1;
PlaySound(0,0,SND_FILENAME);
break;
}
}
else if((m.x>146&&m.x<198)&&(m.y>344&&m.y<399)&&op==0)
{
outtextxy(152,410,s2);
setlight();
FlushBatchDraw(146,344,199,429);
if(m.uMsg==WM_LBUTTONDOWN)
{
flag_m = 2;
PlaySound(0,0,SND_FILENAME);
break;
}
}
else if((m.x>482&&m.x<532)&&(m.y>349&&m.y<413)&&op==0)
{
outtextxy(480,410,s3);
setlight();
FlushBatchDraw(480,349,534,433);
if(m.uMsg==WM_LBUTTONDOWN)
{
putimage(100,20,&img_2);
op=1;
}
}
else if((m.x>573&&m.x<623)&&(m.y>358&&m.y<408)&&op==0)
{
outtextxy(580,413,s4);
setlight();
FlushBatchDraw(573,358,623,429);
if(m.uMsg==WM_LBUTTONDOWN)
break;
}
else if(op==1)
{
if((m.x>500&&m.x<530)&&(m.y>29&&m.y<56))
if(m.uMsg==WM_LBUTTONDOWN)
{
putimage(0,0,&img_1);
op=0;
}
}
else
{
putimage(0,0,&img_1);
FlushBatchDraw();
}
}
EndBatchDraw();
}
int main()
{
int scene=0;
if(scene==0)
{menu1();}
if(scene==1)
{
menu2();
}
return 0;
}