Sample accurate automation for JS needed, @slider is highly inaccurate
A solution to provide sample accurate automation for JS
--- THE PROBLEM ---
JS automation is not sample accurate: You determine if a slider has changed or not in @slider, and then react upon that in @block. But the size of a block is variable, so attempting to make automations relative to the groove of a song may be impossible.
For example, I had to put this code into @block:
midisend(0, msg1, msg23);
Why 0? Because JS provides no information about the timing of events that triggered @slider. So all of my automation updates are imprecisely quantized onto a variably sized @block boundary.
--- THE SOLUTION ---
I can propose one solution, a new section called '@event'
- @event is called for each atomic automation update coming from a JS GUI or from Reaper automation.
- Within a given call to @event three active variables shall be provided:
1) slider_idx
2) slider_value
3) sampleoffset
- midisend() shall also be a valid call in @event, so that we don't have to create our own array to remember the updates that came in.
This also solves another major problem that @slider has: You had to "KEEP TRACK OF THE CURRENT VALUE FOR EACH KNOB AND THEN CHECK TO SEE IF IT CHANGED OR NOT AND IF SO SEND IT OUT". But this is horrible, because I specifically need to send a REPEATING VALUE sometimes. You literally cannot detect that you've automated 128, 64, 64, 32, 128 using @slider, because there's no way to know that 64 occurred twice. You can only check if a slider no longer matches its previous value.
|