User Tools

Site Tools


playing_20multiple_20wav_20files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
playing_20multiple_20wav_20files [2018/03/31 13:19] – external edit 127.0.0.1playing_20multiple_20wav_20files [2024/01/05 00:21] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Playing multiple WAV files===== =====Playing multiple WAV files=====
  
-//by Richard Russell, February 2013//\\ \\  The method described in the main Help documentation for [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#playsound|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:\\ +//by Richard Russell, February 2013//\\ \\  The method described in the main Help documentation for [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#playsound|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 bb4w>
         wavfile1$ = "C:\windows\media\Windows XP Shutdown.wav"         wavfile1$ = "C:\windows\media\Windows XP Shutdown.wav"
         wavfile2$ = "C:\windows\media\Windows XP Startup.wav"         wavfile2$ = "C:\windows\media\Windows XP Startup.wav"
Line 11: Line 13:
         SYS "mciSendString", "play wav1", 0, 0, 0         SYS "mciSendString", "play wav1", 0, 0, 0
         SYS "mciSendString", "play wav2", 0 ,0, 0         SYS "mciSendString", "play wav2", 0 ,0, 0
-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> 
 + 
 +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 bb4w>
         reply1$ = STRING$(16, CHR$(0))         reply1$ = STRING$(16, CHR$(0))
         reply2$ = STRING$(16, CHR$(0))         reply2$ = STRING$(16, CHR$(0))
Line 17: Line 23:
         SYS "mciSendString", "status wav1 position", reply2$, LEN(reply2$), 0         SYS "mciSendString", "status wav1 position", reply2$, LEN(reply2$), 0
         IF reply1$ = reply2$ THEN PRINT "Finished playing"         IF reply1$ = reply2$ THEN PRINT "Finished playing"
 +</code>
playing_20multiple_20wav_20files.1522502374.txt.gz · Last modified: 2024/01/05 00:17 (external edit)