Playing+multiple+WAV+files

//by Richard Russell, February 2013//

The method described in the main Help documentation for [|playing WAV files] only allows you to play one file at a time. If you want to play two or more WAV files **simultaneously** a different approach must be used. The code snippet below demonstrates how to do it: code format="bb4w" wavfile1$ = "C:\windows\media\Windows XP Shutdown.wav" wavfile2$ = "C:\windows\media\Windows XP Startup.wav" SYS "mciSendString", "close wav1", 0, 0, 0 SYS "mciSendString", "close wav2", 0, 0, 0 SYS "mciSendString", "open """ + wavfile1$ + """ alias wav1", 0, 0, 0 SYS "mciSendString", "open """ + wavfile2$ + """ alias wav2", 0, 0 ,0 SYS "mciSendString", "play wav1", 0, 0, 0 SYS "mciSendString", "play wav2", 0 ,0, 0 code Note that the **close** commands are not required if the code is executed only once.

If you want to test whether a file has finished playing you can do so as follows: code format="bb4w" reply1$ = STRING$(16, CHR$(0)) reply2$ = STRING$(16, CHR$(0)) SYS "mciSendString", "status wav1 length", reply1$, LEN(reply1$), 0 SYS "mciSendString", "status wav1 position", reply2$, LEN(reply2$), 0 IF reply1$ = reply2$ THEN PRINT "Finished playing" code