11desc:MIDI Multi Channel Pre-Delay
22author: Ben 'Talagan' Babut
3- version: 0.6
3+ version: 0.7
44donation:
55 https://www.paypal.com/donate/?business=3YEZMY9D6U8NC&no_recurring=1¤cy_code=EUR
66license:
77 MIT (Do whatever you like with this code).
88changelog:
9- - [Feature] Added "Max Delay" option, in case 1 second is not sufficient
10- - [Feature] Added "Don't delay live events" option, using companion JSFX
11- - [Prereq] Added companion JSFX for option above
9+ - [Bug Fix] Live Flagger cleanup was not invalidating all obsolete events if multiple instances were active
1210provides:
1311 talagan_MIDI Multi Channel Pre-Delay Live Flagger.jsfx
1412about:
@@ -109,6 +107,7 @@ g_buf_r = 0;
109107g_max_pre_delay = 0;
110108g_last_srate = srate;
111109
110+
112111//-----------------------
113112
114113function iround(f) (
@@ -173,8 +172,8 @@ function isLiveEvent(offset, msg1, msg2, msg3)
173172
174173 while( (gmem[cursor] == MAGIC_NUMBER) && !found) (
175174
176- // UID and Offset should match
177- ( (gmem[cursor+1] == UID) && (gmem[cursor+5] == offset) )?(
175+ // UID and Offset should match and even should not be invalidated
176+ ( (gmem[cursor+1] == UID) && (gmem[cursor+5] == offset) && (gmem[cursor+3] != -1) )?(
178177 // Test message content
179178 _msg = gmem[cursor+4];
180179
@@ -208,7 +207,7 @@ onSliderChange();
208207//////////////////////////////////////////////////
209208
210209function processEvents()
211- local(delay_samples, delay_sc, delay_isc, msg1, msg2, msg3, is_recording,
210+ local(delay_samples, delay_sc, delay_isc, msg1, msg2, msg3,
212211 msg_len, msg_chan, msg_type, msg_has_channel, msg_pos, msg_emitted,
213212 is_candidate, packet)
214213(
@@ -251,7 +250,6 @@ function processEvents()
251250
252251 msg_chan = (msg1 & 0x0F);
253252 msg_type = ((msg1 & 0xF0) >> 4);
254- is_recording = (play_state == 5);
255253
256254 // If plugin evolves, add some conditions here
257255 is_candidate = 0;
@@ -274,7 +272,6 @@ function processEvents()
274272 g_buf_r[2] = midi_bus | 0; // Bus and re-emitted status
275273
276274 g_buf_r += HEADER_SIZE + msg_len; // Advance by total packet length
277-
278275 ) : (
279276 midisend_buf(msg_pos, g_buf_r + HEADER_SIZE, msg_len);
280277 );
0 commit comments