Closes a MIDI port that is currently open.
Synopsis
error = MidiIoClosePort(options)
Args
options is one of the following:
Option Meaning 'I' (Input) Close any input port, rather than an output port.
Returns
An empty string if successful, or an error message if a failure.
Notes
The error message depends upon the driver for the MIDI Interface you're using. It could be any error message returned by that driver.
No error is reported if you do not have any port open when you call MidiIoClosePort().
If a port fails to close, then it is still considered open, and a subsequent call to MidiIoOpenPort() may fail. In the case of a MidiIoClosePort() failure, it is best to SLEEP() for a little while, and then attempt to close the port once again.
If your script ends without closing any port that it has opened, then that port is automatically closed.
Closing an input port discards any MIDI input that may have been received, but not yet read, by your script.
Examples
/* Close any open output port, and make sure that it closes. */ DO UNTIL error == "" error = MidiIoClosePort() END