Code: Select all
decl i;
for(i=0; i<7; i++) {
midiout(0,{sysexSOX,sysexhdr_req,dynamics.sys_comp_hdr,dynamics.sys_comp_params[i],sys_channel,sysexEOF});
}
Problem: I have to press the channel select several times to get all the variables to populate. I suspect that either the data is being sent to the console faster than it can handle, or the responses are coming in faster than Lemur can handle, though I don't know how to sort out which, and frankly don't care. I've searched high and low for something the equivalent of "wait 20;", "sleep 20;", or something simple that would let me just make the dang loop pause for 20 milliseconds or something before running the next iteration to give the whole thing time to send and receive the data.
Attempted solution 1: I looked at several templates in the user library, and tried variations on the "if (time - prevtime < 20)..." syntax, but can't find one that works for a basic loop. Continue on non-match increments the count, which skips a variable. Return skips all but the first iteration. I don't think I want an onFrame script, since I only want it to send the data when I select a new channel. I've been using a Manual script, since that makes the most sense to me. Do this function only when called by the channel select strip.
Attempted solution 2: I added an additional "for(t=0; t<500; t++) {}" before the end of the first loop, and tried a variety of values for the t<500 section. At t<500, it works most of the time, but not always. I still have to press the button 3 times to make absolutely certain.
Attempted solution 3: I tried to integrate the sending and processing into one script so that it would send the threshold request, set the value; send the attack request, set the value; etc... this turned into a horrible mess of code that I gave up on, but if that's the best way to go, I'll revisit it.
Any guidance graciously appreciated. I haven't done any coding since that introductory course in high school, and the rust is taking quite awhile to shake off. The absence of such seemingly simple commands as wait or sleep only adds to the consternation despite my excitement at the opportunities Lemur seems to offer!
Thanks in advance,
CS