InterpretMIDIMessage

Executes a MIDI message.

Synopsis

Err InterpretMIDIMessage( ScoreContext *ScoreCon,char *MIDIMsg, int32 IfMute )

Description

This function executes a MIDI message by calling another Music library function appropriate to that message, and passing the message's data to that function. The called function uses Audio folio functions for playback based on the settings of a ScoreContext data structure.

InterpretMIDIMessage() is called by InterpretMIDIEvent(), which extracts MIDI messages from Juggler sequences containing MIDI events. Although this function is used most often as an internal call of the Music library, tasks may call it directly to execute a supplied MIDI message. The message should be stored in the first byte (first character) of the MIDIMsg string, followed by data bytes (if present) in subsequent bytes of the string.

Whenever the IfMute argument is set to TRUE, this function does not process Note On messages with velocity values greater than zero. In other words, it doesn't start new notes, but it does release existing notes and process all other recognized MIDI messages. When IfMute is set to FALSE, this function processes all recognizable messages, including Note On messages.

Note that InterpretMIDIEvent() reads a Juggler sequence's mute flag and, if true, passes that true setting on to InterpretMIDIMessage() so that the sequence stops playing notes. It likewise passes a false setting on to InterpretMIDIMessage() so that the sequence can play notes.

Arguments

ScoreCon
Pointer to a ScoreContext data structure.
MIDIMsg
Pointer to a character string containing the MIDI
message.
IfMute
A flag that turns muting on or off. TRUE is on, FALSE is off.

Return Value

This function returns 0 if successful or an error code (a negative value) if an error occurs.

Implementation

Library call implemented in music.lib V20.

Associated Files

score.h, music.lib

Caveats

This function only handles Note On, Note Off, Change Program, Change Control (values 7 and 10), and Pitchbend MIDI messages. It does not support running status.

See Also

InterpretMIDIEvent()