int MidiParser::parse |
( |
midi_byte_t * |
input, |
|
|
unsigned int |
length |
|
) |
| |
Parses some midi messages.
- Parameters
-
input | the array to read from |
length | the maximum number of values available at the array |
- Returns
- the number of bytes parsed
void MidiParser::setCallback |
( |
void(*)(MidiChannelMessage, void *) |
newCallback, |
|
|
void * |
arg = NULL |
|
) |
| |
|
inline |
Sets the callback to call when a new MidiChannelMessage is available from the input port.
The callback will be called with two arguments: callback(MidiChannelMessage newMessage, void* arg)
In order to deactivate the callback, call this method with NULL as the first argument. While the callback is enabled, calling numAvailableMessages() and getNextChannelMessage() is still possible, but it will probably always return 0 as the callback is called as soon as a new message is available.
- Parameters
-
newCallback | the callback function. |
arg | the second argument to be passed to the callback function. |
- Examples:
- Communication/MIDI/render.cpp.
bool MidiParser::isCallbackEnabled |
( |
| ) |
|
|
inline |
Checks whether there is a callback currently set to be called every time a new input MidiChannelMessage is available from the input port.
void MidiParser::setSysexCallback |
( |
void(*)(midi_byte_t, void *) |
newCallback, |
|
|
void * |
arg = nullptr |
|
) |
| |
|
inline |
Sets the callback to call when a new sysex byte is available from the input port.
The callback will be called with two arguments: callback(midi_byte_t byte, void* arg)
To signal the end of a sysex transmission, byte 0xF0
will be passed to the callback. In order to deactivate the callback, call this method with nullptr as the first argument.
- Parameters
-
newCallback | the callback function. |
arg | the third argument to be passed to the callback function. |
- Examples:
- Communication/MIDI/render.cpp.
bool MidiParser::isSysexCallbackEnabled |
( |
| ) |
|
|
inline |
Checks whether there is a callback currently set to be called every time a new sysex byte is available from the input port.
int MidiParser::numAvailableMessages |
( |
| ) |
|
|
inline |
Get the oldest channel message in the buffer.
If this method is called when numAvailableMessages()==0, then a message with all fields set to zero is returned.
- Returns
- a copy of the oldest message in the buffer
The documentation for this class was generated from the following files:
- libraries/Midi/Midi.h
- libraries/Midi/Midi.cpp