MCI Overview

All uses of the MCI follow the same pattern: you open a device, you run some commands, then you close the device when you're done. Each of these commands must be followed by a device name. Many commands take additional parameters that can follow the device name, which further qualify what the command should do. These parameters may be given in any order. For example, the play command starts playing a device at its current position. It takes optional from and to parameters, which specify where it should start and stop playing, as in:

MCI [play cdaudio from 2 to 3]

which tells the Media Control Interface to play track 2 of an audio CD and to stop when it gets to track 3.

Commands may accept different parameters based on the device type. For example, play on a cdaudio device only accepts to and from parameters. In contrast, play on an animation device (a movie) additionally accepts fast, slow, reverse, scan, and speed parameters.

Some parameters only need to be present to have an effect. These parameters are more commonly called "flags". Other parameters require one or more values, which must directly follow the parameter name. For example, in the play command below, the slow flag just needs to be present, but the from parameter must be followed by a position value.

MCI [play animation slow from 5]

All commands are asynchronous, unless otherwise specified. This means that FMSLogo runs the command immediately, but doesn't wait for the command to finish before running the next Logo instruction. In general, this is what you want. However, all commands optionally accept a wait flag, which instructs FMSLogo to wait until the command has finished before running the next instruction. During this time, FMSLogo will be unresponsive, so use this flag with caution. If you specify wait and then realize that you don't want to wait anymore, you can press Ctrl+Break to stop waiting.

If you don't want to wait for a command to finish, but would like to be notified when it does, you can specify the notify flag. In this case, you must also specify an instruction list as the second input to MCI. The following code uses the notify flag to print out a message when a CD audio track stops playing.

(MCI [play cdaudio from 2 to 3 notify] [PRINT [Track 2 has finished playing]])

SourceForge.net Logo