MIDIGetInfo

Returns information about the MIDI file loaded into RAM.

Synopsis

info = MIDIGetInfo(option)

Args

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

Option Meaning
'BASE' The timebase (resolution)
'TRKS' The count of MIDI tracks
'TYPE' The format (ie, 0, 1, or 2)
'EVTS' The number of events in the currently selected track

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

Returns

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

Notes

If you call MIDIGetInfo() before calling MIDIOpenFile() to load/create a file in RAM, then a REXX SYNTAX condition is raised. CONDITION('E') returns error number 40.1 and CONDITION('D') returns the message DLL function "MidiGetInfo" reported MIDI file not yet loaded!.

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 MIDIGetInfo argument 1, option must start with one of "<options>"; found "<badchoice>" where <options> are the allowable choices and <badchoice> is what you erroneously passed.

You may wish to set the currently selected track, via a call to either MIDITrack or MIDIGetEvent, before querying the number of events.

As you delete/insert events/tracks, the information returned by MIDIGetInfo() will reflect these changes.

Examples

/* Query the number of tracks */
num = MIDIGetInfo('TRKS')
IF num \== "" THEN SAY 'Number of tracks:' num

/* Query the number of events in currently selected track */
num = MIDIGetInfo('EVTS')
IF num \== "" THEN SAY 'Number of events:' num