MidiIoOpenPort

Opens the desired MIDI port.

Synopsis

error = MidiIoOpenPort(portID, options)

Args

portID is the ID (number) of the desired port to open. If omitted (or 0 is passed), then MIDI Mapper is opened for output.

options is one of the following:

Option
Meaning
'I' (Input) Open an input port, rather than an output port.
'NAME' (Name) portID is the port's name, rather than its ID number.

Returns

An empty string if successful, or an error message if a failure.

Notes

If another port is already open, then it is first closed before the new port is opened. RxMidiIO supports only one port open at a time. You can have one input port open simultaneously with one output port.

If you pass a non-numeric value for portID, then a SYNTAX condition is raised. CONDITION('E') returns error number 40.12 and CONDITION('D') returns the message MIDIIOOPENPORT argument 1; must be a whole number; found "<badarg>" where <badarg> is what you erroneously passed.

For all other errors, the error message depends upon the driver for the MIDI Interface you're using. It could be any error message returned by that driver.

Examples

/* Open MIDI Mapper, and display any error message. */
err = MidiIoOpenPort()
IF err \== "" THEN SAY err