我使用 df['dob_num'] = [float(i[-3:-1]) for i in df.dob]
在后台播放音乐。我的游戏中有一些按钮会在用户单击按钮时播放短促的声音,并且会停止音乐。我怎样才能让音乐在整个游戏中播放?我使用 PlaySound(TEXT("background.wav"), NULL, SND_FILENAME | SND_LOOP | SND_ASYNC);
作为按钮声音。
答案 0 :(得分:0)
我的游戏中有一些按钮会在用户 单击按钮,它将停止音乐。
您可以使用 ,SUBSTRING(t.[QuestionID],12,200) AS [QuestionID2]
循环播放背景音乐。然后使用 mciSendString 播放一段简短的声音。
像这样:
PlaySound
您还可以根据需要使用 //play music in the background
PlaySound(TEXT("background.wav"), NULL, SND_FILENAME | SND_LOOP | SND_ASYNC);
...
//Press Button 1
mciSendString(L"close Sound_1", NULL, 0, NULL);//need to close first
LPCWSTR const Sound_File_1 = L"open button.wav type mpegvideo alias Sound_1";
mciSendString(Sound_File_1, NULL, 0, NULL);
MCIERROR play = mciSendString(L"play Sound_1", NULL, 0, NULL);
//Press Button 2
mciSendString(L"close Sound_2", NULL, 0, NULL);//need to close first
LPCWSTR const Sound_File_2 = L"open button_2.wav type mpegvideo alias Sound_2";
mciSendString(Sound_File_2, NULL, 0, NULL);
MCIERROR play = mciSendString(L"play Sound_2", NULL, 0, NULL);
循环播放背景音乐。
mciSendString