PLAYMIDI

PLAYMIDI filename, length

Description:

This plays a *.MIDI sound from a file on disk as specified in filename. The length variable will hold the length of the MIDI file (not in seconds). You can only play one file at a time. Periodically, you will need to use the MIDIPOS( ) function to see if you've reached the end of the music:

Finally, use the STOPMIDI command to close the music file before you can play a different one.

Usage:

  'the playmidi command returns the length of the midi in
  'the variable howLong
  playmidi "c:\somedir\mymusic.midi", howLong
  timer 1000, [checkPlay]
  wait

[checkPlay]
  if howLong = midipos( ) then [musicEnded]
  wait

[musicEnded]
  stopmidi
  timer 0
  wait

See also: STOPMIDI, MIDIPOS()