The following procedure uses the Media Control Interface to play a MIDI file.
TO PLAY.MIDI IGNORE MCI [open c:\\windows\\media\\flourish.mid type sequencer alias flourish] MCI [play flourish] WAIT 600 MCI [stop flourish] MCI [close flourish] END
Let's take a closer look at each instruction in the example above.
The procedure first opens the MIDI file "c:\windows\media\flourish.mid" by issuing an
type parameter is set to
sequencer, which is the device name for the MIDI sequencer.
We use the
alias parameter so that we can refer to this media entity as
flourish instead of always using the full path to flourish.mid.
Unlike most other commands, the
open command outputs a value on success.
Since Logo programs must do something with every value that is output, we simply IGNORE it.
play command is used to start playing the MIDI file.
The video plays asynchornously, which means that FMSLogo doesn't wait for the music to finish playing before running the next instruction.
The WAIT instructions just waits for ten seconds. This has nothing to do with MCI, it just gives you some time to listen to the music before it is stopped.
stop command stops the song from playing.
close command is used to tell the Media Control Interface that you are done with the MIDI file.