浏览代码

SysEx callbacks filter condition moved to outer if.

Przemyslaw Wegrzyn 11 年之前
父节点
当前提交
312a94caf5
共有 1 个文件被更改,包括 17 次插入19 次删除
  1. 17 19
      RtMidi.cpp

+ 17 - 19
RtMidi.cpp

@@ -422,26 +422,24 @@ void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef
       }
       continueSysex = packet->data[nBytes-1] != 0xF7;
 
-      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();
+      if ( !( data->ignoreFlags & 0x01 ) && !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 {