MCI

From GMpedia.org Wiki

Jump to: navigation, search

MCI stands for Media Control Interface or Multimedia Control Interface. It is an API that allows software developers to easily implement media support in their Windows programs.

[edit] Devices

The MCI interface uses so-called "devices". These devices are required to be able to play media. These devices are divided into two groups:

  • Compound devices, where the driver requires the name of a data file
  • Simple devices, which do not require the name of a data file

The names of the installed devices can be found in the system.ini file in the WINDOWS directory. They can also be found in the Windows registry in the following keys:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI (16-bit)
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32 (32-bit)

Devices are always of a certain type. The most common types are:

  • cdaudio: plays audio cd's
  • waveaudio: used to play wave files
  • digitalvideo: plays digital video
  • sequencer: used to play MIDI music

[edit] MCI Command Strings

To make those devices do something, you need to send commands to them. This can be done with command strings.

The function with which you can send these strings varies depending on the programming language. This function can then return a value if you've asked a device to do so.

Let's take a look at an example:

open "c:\sound.wav" type waveaudio alias "sound"
play "sound"

The first line opens the device. This always needs to be done first when you want to play media.

"c:\sound.wav" indicates the file to be played by the waveaudio device.

Next is the keyword "type" followed by the device type, in this case waveaudio.

Then there is the keyword "alias". This indicates that you will assign an alias to the device. If you enter such an alias, it needs to be used in all other commands. In the example, the alias for waveaudio is "sound".

The second line plays the file. For this, you need to use the command "play" followed by the device name. In this example, we have given an alias for the device to use. That's why we use the alias instead of the device name.

[edit] External Reading

  • MSDN, which includes a full list of MCI commands.
Retrieved from "http://gmpedia.org/wiki/MCI"
Personal tools