The MCI MIDI sequencer plays standard MIDI files and RIFF MIDI files (RMID files). Standard MIDI files conform to the “Standard MIDI Files 1.0” specification. See Chapter 78, “Introduction to Audio” for information about this specification. Because RMID files are standard MIDI files with a RIFF header, information on standard MIDI files also applies to RMID files.
There are currently three variations of standard MIDI files. The MCI sequencer plays only two of these: Format 0 and Format 1 MIDI files.
Note:
If the MCI MIDI sequencer encounters a MIDI file not marked as being authored for Windows, it will display a dialog box informing the user. MIDI files authored for Windows should be marked with the MARKMIDI utility program. For additional information about the MARKMIDI utility, see the last section of this chapter, “Using the MARKMIDI Utility.”
The division type of a MIDI sequence refers to the technique used to represent the time between MIDI events in the sequence. Use the MCI_STATUS command and set the dwItem field of the MCI_STATUS_PARMS parameter block to MCI_SEQ_STATUS_DIVTYPE to determine the division type of a sequence.
If the MCI_STATUS command is successful, the dwReturn field of the MCI_STATUS_PARMS parameter block contains one of the following values to indicate the division type:
Value | Division Type |
MCI_SEQ_DIV_PPQN | PPQN (parts-per-quarter note) |
MCI_SEQ_DIV_SMPTE_24 | SMPTE, 24 fps (frames per second) |
MCI_SEQ_DIV_SMPTE_25 | SMPTE, 25 fps |
MCI_SEQ_DIV_SMPTE_30 | SMPTE, 30 fps |
MCI_SEQ_DIV_SMPTE_30DROP | SMPTE, 30 fps drop frame |
You must know the division type of a sequence to change or query its tempo. You can't change the division type of a sequence using the MCI sequencer.
Use the MCI_STATUS command and set the dwItem field of the MCI_STATUS_PARMS parameter block to MCI_SEQ_STATUS_TEMPO to get the tempo of a sequence. If the MCI_STATUS command is successful, the dwReturn field of the MCI_STATUS_PARMS parameter block contains the current tempo.
To change tempo, use the MCI_SET command with the MCI_SEQ_SET_PARMS parameter block. Specify the MCI_SEQ_SET_TEMPO flag and set the dwTempo field of the parameter block to the desired tempo. MMSYSTEM.H defines the MCI_SEQ_SET_PARMS parameter block as follows:
typedef struct {
DWORD dwCallback; /* callback for MCI_NOTIFY flag */
DWORD dwTimeFormat; /* time format */
DWORD dwAudio; /* audio channel (not used) */
DWORD dwTempo; /* tempo */
DWORD dwPort; /* output port */
DWORD dwSlave; /* slave sync type */
DWORD dwMaster; /* master sync type */
DWORD dwOffset; /* SMPTE offset */
} MCI_SEQ_SET_PARMS;
The way tempo is represented depends on the division type of the sequence. If the division type is PPQN, the tempo is represented in beats per minute. If the division type is one of the SMPTE division types, the tempo is represented in frames per second. See the previous section, “Querying for Sequence Division Types,” for information on determining the division type of a sequence.
To change the synchronization mode of a sequencer device, use the MCI_SET command along with the MCI_SEQ_SET_MASTER and MCI_SEQ_SET_SLAVE flags. Two fields in the MCI_SEQ_SET_PARMS parameter block, dwMaster and dwSlave, are used to specify the master and slave synchronization modes.
The master synchronization mode controls synchronization information sent by the sequencer to an output port. The slave synchronization mode controls where the sequencer gets its timing information to play a MIDI file. The following table shows the different modes for master and slave synchronization and the corresponding constant for the dwMaster and dwSlave fields:
Constant | Synchronization Mode |
Master | |
MCI_SEQ_MIDI | MIDI Sync—Send timing information to output port using MIDI timing clock messages |
MCI_SEQ_SMPTE | SMPTE Sync—Send timing information to output port using MIDI quarter frame messages |
MCI_SEQ_NONE | No Sync—Send no timing information |
Slave | |
MCI_SEQ_FILE | File Sync—Get timing information from MIDI file |
MCI_SEQ_MIDI | MIDI Sync—Get timing information from input port using MIDI timing clock messages |
MCI_SEQ_SMPTE | SMPTE Sync—Get timing information from input port using MIDI quarter frame messages |
MCI_SEQ_NONE | No Sync—Get timing information from MCI commands only and ignore timing information such as tempo changes that are in the MIDI file |
Note:
Currently, for master synchronization, the MCI MIDI sequencer supports only the “no synchronization” mode (MCI_SEQ_NONE). For slave synchronization, it only supports the file synchronization mode (MCI_SEQ_FILE) and the “no synchronization” mode (MCI_SEQ_NONE).