diff options
| author | Przemyslaw Wegrzyn <pwegrzyn@codepainters.com> | 2014-03-02 23:26:31 +0100 |
|---|---|---|
| committer | Przemyslaw Wegrzyn <pwegrzyn@codepainters.com> | 2014-03-02 23:26:31 +0100 |
| commit | 977c8db6b6d89d0bb79cb719cf5721f1fee7546c (patch) | |
| tree | 05b13517c6bf8feba55e8e8d0003e1de7c42957a | |
| parent | 2b9a455f8f44697e4af1bf5798b8a34217263ad2 (diff) | |
Avoid 0-sized message callbacks if SysEx msgs are ignored altogether.
| -rw-r--r-- | RtMidi.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
@@ -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 { |
