You can use custom variables to develop a trigger system to scale, I had to do it for a Komplete Kontrol DAW mode mapping as the encoders were super sensitive unless the shift button was held (i.e. the smallest turn was 3 steps I believe, instead of 1.)
Very rudimentary attempt, but I first declared a constant for the scale I wanted:-
const kk_knobscale = 0.16;
//Knob public arrays
var kk_knob = new Array(); //Surface 'make' object
var kk_knob_trig = new Array(); //Surface trigger
var kk_knob_trigval = new Array(); //Surface trigger current val
Then within the surface setups I created customValueVariable’s to act as triggers, and the knobs set to absolute mode so that I could manipulate the raw values being received :-
for (var knset = 0; knset < surfaceElements.numStrips; ++knset) {
kk_knob.push(surface.makeKnob(0 + (2 * knset), 0, 0, 0));
kk_knob[knset].mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(CTRL_CHAN, 80 + knset).setTypeAbsolute()
kk_knob_trig.push(surface.makeCustomValueVariable('kk_knob_trig_' + knset))
kk_knob_trigval.push(0.0)
kk_knob[knset].mSurfaceValue.mOnProcessValueChange = (function (activeDevice, value) {
kk_knob_trigval[this.knset] = kk_scaleme(kk_knob_trigval[this.knset], value);
kk_knob_trig[this.knset].setProcessValue(activeDevice, kk_knob_trigval[this.knset]);
}).bind({ knset })
}
Then the kk_scaleme function just deals with the relative splits and applies the scale based on the previous value and the new value:-
function kk_scaleme(oldVal, newVal) {
var sendVal = 0.0;
var turnVelocity = 0;
if (newVal > 0.5) {
//Anticlock
turnVelocity = (newVal - (1 + (1 / 127)));
sendVal = oldVal + (turnVelocity * kk_knobscale);
} else {
//Clock
turnVelocity = newVal;
sendVal = oldVal + (turnVelocity * kk_knobscale);
}
if (sendVal < 0) { sendVal = 0; } else if (sendVal > 1) { sendVal = 1; }
return sendVal;
}
Then for the map binds, you just use the triggers as setup, i.e.
page.makeValueBinding(kk_knob_trig[0], focus_eq.mBand1.mFreq)
If that doesn’t make sense, I’ll try and break it down into an easier/more generic example - as the above is pushing into arrays as I needed to track the states of each in a systematic nature.