*** Note: This documentation is out of date ***
MidiPort class overview
MidiPort
handles the MIDI I/O port connections for the
MidiOutput
and MidiInput classes. MidiPort is the class in which to place
hardware/operating dependent functions. Such functions are described
further below.
There can be any number of MidiPort instances, each of which directs
input/output to a common set of MIDI I/O locations of which there are
currently allowed to be up to 8:
In general, a MIDI port will be opened automatically when an instance
belonging to that port is created, and all MIDI ports will be closed
just before the last instance of a MidiPort class goes out of scope.
The functions open and close can alternatively be used to
manually control connection to a MIDI port. See the
constructor for disabling
automatic opening of a MIDI port.
There are several functions which are dependent on the operating
system (and will have to be modified for each new computer configuation
added):
- open()
- This command sets up the connection with the MIDI port.
- close()
- This command disconnects the MIDI port, freeing it up for
other programs to use.
- rawsend(unsigned char aByte, int flushQ = 1)
- This command sends one byte of informations to the MIDI cable.
Actually this command stores the byte in an output buffer that
waits until a flush command is given. There is no possibility of
recording to a separate file the output being send (hence the
name rawsend. See the MidiOutput class send command if
you want to record output.
- flush()
- This command sends all of the bytes in the output buffer to the
MIDI cable and empties the output buffer.
Program example usage
- Here is a short example program using 4Front Technoligies' OSS
soundcard driver in the Linux operating system:
directOut.cc
- Here is a program which does the same thing as the program
above but using MidiPort class: midiportest.cc
- And here is a program which does the same thing as the program
above but using the MidiOutput class:
midioutputest.cc