User Tools

Site Tools


pausing_20and_20resuming_20midi_20playback

Differences

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

Link to this comparison view

pausing_20and_20resuming_20midi_20playback [2018/03/31 13:19]
127.0.0.1 external edit
pausing_20and_20resuming_20midi_20playback [2018/04/15 12:34] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Pausing and resuming MIDI playback===== =====Pausing and resuming MIDI playback=====
  
-//by Richard Russell, May 2006//\\ \\  BBC BASIC for Windows allows you to play a MIDI file using the ***PLAY** command. Whilst you can terminate playback before the song has finished by using the **SOUND OFF** statement, there is no built-in mechanism for //pausing// playback.\\ \\  The program below makes it possible to pause and resume playback. For the purposes of the example a key-press is used, but the code can be adapted to control playback from any other source. For example in a game you may wish to pause the music whilst a high-score table is displayed.\\ \\ +//by Richard Russell, May 2006//\\ \\  BBC BASIC for Windows allows you to play a MIDI file using the ***PLAY** command. Whilst you can terminate playback before the song has finished by using the **SOUND OFF** statement, there is no built-in mechanism for //pausing// playback.\\ \\  The program below makes it possible to pause and resume playback. For the purposes of the example a key-press is used, but the code can be adapted to control playback from any other source. For example in a game you may wish to pause the music whilst a high-score table is displayed. 
 + 
 +<code bb4w>
         *PLAY C:​\Windows\Media\Flourish.mid         *PLAY C:​\Windows\Media\Flourish.mid
  
Line 40: Line 42:
         SWAP T%,@midi%         SWAP T%,@midi%
         ENDPROC         ENDPROC
 +</​code>​
 +
 You may need to change the MIDI file specification if your PC doesn'​t have **Flourish.mid** in that location. You may need to change the MIDI file specification if your PC doesn'​t have **Flourish.mid** in that location.
pausing_20and_20resuming_20midi_20playback.txt · Last modified: 2018/04/15 12:34 by richardrussell