MIDIEventProp

Returns information about a certain event type, or about the currently selected event's type.

Synopsis

info = MIDIEventProp(option, type)

Args

type is an event ID number (ie, 144) or name (ie, "On Note"). If omitted, then the currently selected event's ID number is used.

option determines which information is returned. It should be one of the following:

Option Meaning
'TYPE' Returns the event name (ie, "On Note", "Off Note", etc) if type is an ID number, or the corresponding ID number if type is a name.
'CHAN' Returns 'YES' if type is a voice category event (ie, an event that has a channel), or 'NO' if not.
'FREQ' Returns 'YES' if type's first data value is a MIDI note number (ie, Note and Aftertouch events), or 'NO' if not.
'NOTE' Returns 'YES' if type is a note event (ie, On/Off/(Off) Note), or 'NO' if not.

If option is omitted, it defaults to 'TYPE'.

Returns

The desired information as above, or an empty string if an error.

Notes

If you pass a value for option which is not one of the allowable ones, then a REXX SYNTAX condition is raised. CONDITION('E') returns error number 40.28 and CONDITION('D') returns the message MIDIEventProp argument 1, option must start with one of "<options>"; found "<badchoice>" where <options> are the allowable choices and <badchoice> is what you erroneously passed.

Passing an unknown type will return an empty string, but not raise a condition unless you have set the MidiErr variable to do so.

If you intend to omit type, you may wish to set the currently selected event, via a call to MIDIGetEvent (or by inserting a new event with MIDISetEvent), before calling MIDIEventProp().

Examples

/* Get the name corresponding to an ID number of 144 */
name = MIDIEventProp(, 144)
IF name \== "" THEN SAY 'name =' name

/* Query if the current event is a note event */
answer = MIDIEventProp('NOTE')
IF answer == "YES" THEN SAY 'Currently selected event is a note event'