MULTIMEDIA WINDOWS
MEDIA CONTROL INTERFACE (MCI)
written by
Barry Wood
Version 1.1 - last updated 17 May 1996
Contents
Introduction to MCI
MCI Command Strings
Issuing Command Strings
MCI Device Types
Simple and Compound Devices
Examples of MCI in action
The wait flag
Using all as a device name
List of MCI commands
Introduction.
The Media Control Interface (MCI) provides a high-level generalized interface to control media devices such as audio hardware, movie players, video disc and videotape players. It is available to windows applications. These notes specifically cover examples using the Multimedia Authoring tools Authorware and Guide but the MCI commands given should be generally available to other suitable windows applications.
In Guide the MCI functions are built in to the LOGiiX scripting language that is part of the Guide environment. In Authorware the functions are provided as a UCD called A3WMME.UCD which contains 5 MCI functions. This UCD is distributed by Authorware (Macromedia).
MCI uses device drivers to interpret and execute high-level MCI commands. Applications can communicate with MCI device handlers by sending messages or command strings.
These notes are collected from various places. They are given here in the hope that they are useful. I have not used all the commands, in particular the video overlay and MIDI sequencer commands as I do not have access to this hardware. The usual disclaimers of all knowledge and responsibility apply. If you do find any errors or have any additions you can add please let me know at: email to Barry Wood - University of Nottingham CAL Group Co-ordinator
Back to top of page
MCI COMMAND STRINGS
Details of the command strings are given later.
There are 4 categories of command strings which can be used with the MCICommand
function:
-
System Commands
Interpreted directly by MCI rather than being relayed to a device. The commands are: break, sound and sysinfo.
-
Required commands
Commands supported by ALL MCI devices. These commands are: capability, close, info, open, status
-
Basic Commands
Optional commands for MCI devices that have many options for each command. If a basic command is not supported by a particular device the standard says if should return the string "Action not available for this device". This standard is not always adhered to! The basic commands are: load, pause, play, record, resume, save, seek, status, stop
-
Extended commands
Are specific to a device type e.g. a video disc player. These may be new commands or simply extensions of options to basic commands e.g. set
Back to top of page
ISSUING A COMMAND STRING
Each command string consists of three elements:
command device arguments
e.g.
play cdaudio from 5000 to 15000
MCICommand("play cdaudio from 5000 to 15000")
Back to top of page
MCI DEVICE TYPES
There are several device types that are supported in the MCI standard. The devices are:
- cdaudio
- dat
Digital audio tape player
- digitalvideo
Digital video in a window, not GDI based
- MMMovie
- other
- overlay
Overlay device e.g. analogue video in a window
- scanner
- sequencer
- vcr
Videotape player or recorder
- videodisc
- waveaudio
Audio device that plays digitized waveform files e.g. soundblaster card.
The [mci] section of SYSTEM.INI lists the device types installed and the associated
driver files e.g.
[mci]
cdaudio=MCICDA.DRV
Back to top of page
SIMPLE AND COMPOUND DEVICES
If the device and the files are separate e.g. a soundcard and the sound files
then it is classed as a compound device otherwise it is a simple device e.g.
a CD audio.
Some example device drivers are:
cdaudio MCICDA.DRV
MMMovie MCIMMP.DRV
sequencer MCISEQ.DRV
videodisc MCIPIONR
waveaudio MCIWAVE.DRV
Back to top of page
Example of MCI in action.
A device needs to be opened before it will accept any other commands and it
must be closed after you have finished with it.
With some devices it is necesary to stop the device before closing it e.g. with
authorware you can close the cdaudio and will continue to play unless you stop
it from playing first.
A typical use of MCI in a program will have lines similar to the following:
MCICommand("open cdaudio")
MCICommand("play cdaudio")
MCICommand("stop cdaudio")
MCICommand("close cdaudio")
Obviously there is a need to have a pause between the first two and the last
two commands here!
It is possible to give a device an alias in the open command string and then
use this alias in all the other commands e.g.
MCICommand("open cdaudio alias z")
MCICommand("play z")
Back to top of page
The wait flag
Normally MCI functions return control to the user immediately, even if the command
takes several minutes to complete the action e.g. a tape starts to rewind but
control is returned before the rewinding finishes which continues in the background.
Adding the option wait to a command string tells MCI to wait until the requested
action is complete e.g.
MCICommand("play z wait")
will play the whole CD before returning control to the application.
It is possible to break in to a wait state and regain
control by pressing the break key combination. By default this is Ctrl + Break
but the break key may be user defined by the break option e.g.
MCICommand("break cdaudio on 121")
will set the break key to function key F10. The number given is the virtual
key code.
Back to top of page
Using all as a device name
It is possible to use all as the device name for any command
that does not return data. The most common use would probably be:
MCICommand("close all")
Back to top of page