Public Member Functions

void enableParser (bool enable)
 
MidiParsergetParser ()
 
void setParserCallback (void(*callback)(MidiChannelMessage, void *), void *arg=NULL)
 
int readFrom (int port)
 
int writeTo (int port)
 
int getInput ()
 
int writeOutput (midi_byte_t byte)
 
int writeOutput (midi_byte_t *bytes, unsigned int length)
 
MidiParsergetMidiParser ()
 

Static Public Member Functions

static void midiInputLoop ()
 
static void midiOutputLoop ()
 
static void staticConstructor ()
 

Static Public Attributes

static bool staticConstructed
 

Detailed Description

Member Function Documentation

void Midi::enableParser ( bool  enable)

Enable the input MidiParser.

If the parser is enabled, getInput() will return an error code. Midi messages should instead be retrieved via, e.g.: getMidiParser()->getNextChannelMessage();

Parameters
enabletrue to enable the input MidiParser, false to disable it.
MidiParser* Midi::getParser ( )

Get access to the input parser in use, if any.

Returns
a pointer to the instance of MidiParser, if currently enabled, zero otherwise.
void Midi::setParserCallback ( void(*)(MidiChannelMessage, void *)  callback,
void *  arg = NULL 
)
inline

Sets the callback to call when a new MidiChannelMessage is available from the input port.

Internally, it calls enableParser() and the MidiParser::setCallback();

Parameters
newCallbackthe callback function.
argthe second argument to be passed to the callback function.
Examples:
FFT-phase-vocoder/render.cpp.
int Midi::readFrom ( int  port)

Open the specified input Midi port and start reading from it.

Parameters
portMidi port to open
Returns
1 on success, -1 on failure
Examples:
FFT-phase-vocoder/render.cpp.
int Midi::writeTo ( int  port)

Open the specified output Midi port and prepares to write to it.

Parameters
portMidi port to open
Returns
1 on success, -1 on failure
int Midi::getInput ( )

Get received midi bytes, one at a time.

Returns
-1 if no new byte is available, -2 on error, the oldest not yet retrieved midi byte otherwise
int Midi::writeOutput ( midi_byte_t  byte)

Writes a Midi byte to the output port

Parameters
bytethe Midi byte to write
Returns
1 on success, -1 on error
int Midi::writeOutput ( midi_byte_t *  bytes,
unsigned int  length 
)

Writes Midi bytes to the output port

Parameters
bytesan array of bytes to be written
lengthnumber of bytes to write
Returns
1 on success, -1 on error
MidiParser* Midi::getMidiParser ( )

Gives access to the midi parser, if it has been activated.

Returns
a pointer to the midi parser if active, zero otherwise

The documentation for this class was generated from the following file: