Why are you starting with the difficult things first, I am afraid that pushes the thing in the wrong direction. Nevertheless, here’s some pseudo-code that I haven’t even run. Just a blind shot:
var knob = deviceDriver.mSurface.makeFader(0, 0, 1, 3)
knob.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(15, 21)
var triggerValue1 = deviceDriver.mSurface.makeCustomValueVariable('Trigger1')
var triggerValue2 = deviceDriver.mSurface.makeCustomValueVariable('Trigger2')
var page = deviceDriver.mMapping.makePage('Default')
page.makeCommandBinding(triggerValue1, 'Nudge', 'Left')
page.makeCommandBinding(triggerValue2, 'Nudge', 'Right')
knob.mSurfaceValue.mOnProcessValueChange = function(activeDevice, value) {
if(value < 0.3)
triggerValue1.setProcessValue(activeDevice, 1 - value / 0.3)
else if (value > 0.7)
triggerValue2.setProcessValue(activeDevice, (value - 0.7) / 0.3)
}
The “processvalue” represents the CC-value or note-velocity in a normalized format (from 0 to 1 floating point). Here I have made a security gap between 0.3 and 0.7, otherwise you would always nudge back and forth and stay put.
BUT PLEASE!!! WE ARE VERY MUCH OUTSIDE THE SWEET SPOT HERE!