MidiInPort class public functions

MidiInPort
~MidiInPort
close
closeAll
extract
getCount
getName
getNumPorts
getPort
getPortStatus
getTrace
insert
open
pause
setBufferSize
setPort
setTrace
toggleTrace
unpause

MidiInPort(void);
Sets the MIDI input port to 0, but does not open the port.
MidiInPort(int aPort, int openAuto = 1);
Sets the port on which MIDI output will occur for this object. If openAutoQ == 1, then the specified port will automatically be opened. If openQ == 0, then the user must call the open function to open the port before actually using MIDI output (unless some other MidiInPort object has already opened the port).

~MidiInPort();
If there are no more instances of MidiInPort left, then close all open MIDI ports.

void close(void);
Closes the MIDI input port to which the MidiInPort object belongs. Closing an unopened port will not cause an error, but will be ignored. All other objects connected to the same port will not be able to receive anymore MIDI input once the port is closed.

void closeAll(void);
Closes all open MIDI input ports.

MidiMessage extract(void);
Extracts one MidiMessage from the input buffer for the port that the object is connected to. It is an error to extract a MidiMessage when getCount returns 0 (or less).

int getCount(void);
Returns the number of MidiMessages waiting in the MIDI input buffer.

const char* getName(void);
Returns the name of the MIDI port device.

int getNumPorts(void);
Returns the total number of MIDI output ports that are on the system.

int getPort(void);
Returns the MIDI output port to which the object directs output.

int getPortStatus(void);
Returns 1 if the port is currently open, otherwise return 0.

int getTrace(void);
Returns trueif trace is on; otherwise returns false. If trace is on, then prints to screen the MIDI message received.

void insert(const MidiMessage& aMessage);
Writes the message into the Midi input buffer.

void open(void);
Opens the MIDI port to which the object belongs. If port is already opened, then ignore the open request.

void pause(void);
Stops the MIDI input port from inserting MIDI messages into the buffer, but keeps the port open. Use unpause to reverse the effect of pause().

void setBufferSize(int aSize);
Sets the allocation size of the midi input buffer to which the object belongs. After resizing the buffer, any previously stored MIDI messages will be lost.

void setPort(int aPort);
Changes the MIDI output port to which the MidiInPorMidiInPorMidiInPorMidiInPort object belongs. Will not close the old port nor open the new port.

void setTrace(int aState);
If false, then don't print input MIDI messages to the standard output.

void toggleTrace(void);
Switches the state of the trace variable. Returns the previous state of the trace variable.

void unpause(void);
Enables the Midi input port to start inserting MIDI messages into the buffer after the port is already open.














Send comments/errors on this page to craig@ccrma.stanford.edu