summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemyslaw Wegrzyn <pwegrzyn@codepainters.com>2014-03-02 23:26:31 +0100
committerPrzemyslaw Wegrzyn <pwegrzyn@codepainters.com>2014-03-02 23:26:31 +0100
commit977c8db6b6d89d0bb79cb719cf5721f1fee7546c (patch)
tree05b13517c6bf8feba55e8e8d0003e1de7c42957a
parent2b9a455f8f44697e4af1bf5798b8a34217263ad2 (diff)
Avoid 0-sized message callbacks if SysEx msgs are ignored altogether.
-rw-r--r--RtMidi.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/RtMidi.cpp b/RtMidi.cpp
index 2401559..6c60010 100644
--- a/RtMidi.cpp
+++ b/RtMidi.cpp
@@ -422,24 +422,26 @@ void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef
}
continueSysex = packet->data[nBytes-1] != 0xF7;
- if ( !continueSysex ) {
- // If not a continuing sysex message, invoke the user callback function or queue the message.
- if ( data->usingCallback ) {
- RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) data->userCallback;
- callback( message.timeStamp, &message.bytes, data->userData );
- }
- else {
- // As long as we haven't reached our queue size limit, push the message.
- if ( data->queue.size < data->queue.ringSize ) {
- data->queue.ring[data->queue.back++] = message;
- if ( data->queue.back == data->queue.ringSize )
- data->queue.back = 0;
- data->queue.size++;
+ if ( !( data->ignoreFlags & 0x01 ) ) {
+ if ( !continueSysex ) {
+ // If not a continuing sysex message, invoke the user callback function or queue the message.
+ if ( data->usingCallback ) {
+ RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) data->userCallback;
+ callback( message.timeStamp, &message.bytes, data->userData );
+ }
+ else {
+ // As long as we haven't reached our queue size limit, push the message.
+ if ( data->queue.size < data->queue.ringSize ) {
+ data->queue.ring[data->queue.back++] = message;
+ if ( data->queue.back == data->queue.ringSize )
+ data->queue.back = 0;
+ data->queue.size++;
+ }
+ else
+ std::cerr << "\nMidiInCore: message queue limit reached!!\n\n";
+ }
+ message.bytes.clear();
}
- else
- std::cerr << "\nMidiInCore: message queue limit reached!!\n\n";
- }
- message.bytes.clear();
}
}
else {