forked from nodejs/node-v0.x-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtMidi.cpp_continueSysex.patch
102 lines (96 loc) · 4.39 KB
/
rtMidi.cpp_continueSysex.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
--- RtMidi.cpp.orig 2011-11-27 16:18:33.347981589 +0100
+++ RtMidi.cpp 2011-11-27 16:46:38.537982203 +0100
@@ -245,7 +245,7 @@
if ( !continueSysex ) {
// If not a continuing sysex message, invoke the user callback function or queue the message.
- if ( data->usingCallback && message.bytes.size() > 0 ) {
+ if ( data->usingCallback) {
RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) data->userCallback;
callback( message.timeStamp, &message.bytes, data->userData );
}
@@ -1027,9 +1027,9 @@
}
snd_seq_free_event( ev );
- if ( message.bytes.size() == 0 ) continue;
+ if ( message.bytes.size() == 0 || continueSysex ) continue;
- if ( data->usingCallback && !continueSysex ) {
+ if ( data->usingCallback ) {
RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) data->userCallback;
callback( message.timeStamp, &message.bytes, data->userData );
}
@@ -1638,25 +1638,25 @@
for ( int i=0; i<event.msglen; ++i )
message.bytes.push_back( event.sysexmsg[i] );
if ( event.sysexmsg[event.msglen-1] == 0xF7 ) continueSysex = false;
- if ( !continueSysex ) {
- // If not a continuing sysex message, invoke the user callback function or queue the message.
- if ( data->usingCallback && message.bytes.size() > 0 ) {
- 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 << "\nRtMidiIn: message queue limit reached!!\n\n";
+ }
+ 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++;
}
- message.bytes.clear();
+ else
+ std::cerr << "\nRtMidiIn: message queue limit reached!!\n\n";
}
+ message.bytes.clear();
}
}
mdFree( NULL );
@@ -2511,20 +2511,22 @@
jData->lastTime = time;
- if ( rtData->usingCallback && !rtData->continueSysex ) {
- RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) rtData->userCallback;
- callback( message.timeStamp, &message.bytes, rtData->userData );
- }
- else {
- // As long as we haven't reached our queue size limit, push the message.
- if ( rtData->queue.size < rtData->queue.ringSize ) {
- rtData->queue.ring[rtData->queue.back++] = message;
- if ( rtData->queue.back == rtData->queue.ringSize )
- rtData->queue.back = 0;
- rtData->queue.size++;
+ if ( !rtData->continueSysex ) {
+ if ( rtData->usingCallback ) {
+ RtMidiIn::RtMidiCallback callback = (RtMidiIn::RtMidiCallback) rtData->userCallback;
+ callback( message.timeStamp, &message.bytes, rtData->userData );
+ }
+ else {
+ // As long as we haven't reached our queue size limit, push the message.
+ if ( rtData->queue.size < rtData->queue.ringSize ) {
+ rtData->queue.ring[rtData->queue.back++] = message;
+ if ( rtData->queue.back == rtData->queue.ringSize )
+ rtData->queue.back = 0;
+ rtData->queue.size++;
+ }
+ else
+ std::cerr << "\nRtMidiIn: message queue limit reached!!\n\n";
}
- else
- std::cerr << "\nRtMidiIn: message queue limit reached!!\n\n";
}
}