What value is your hardware sending?
You can create custom variables using makeCustomValueVariable(name)
Then update those custom variables upon hardware changes (.mOnProcessValueChange) within the create elements code.
Then you bind controls to the custom variables, not directly to the hardware receives.
i.e.
[Hardware button] > [Custom Variable Trigger] > [Cubase bind]
Rather than
[Hardware button] > [Cubase bind]
By inserting the custom variable trigger, This allows you to control/manipulate pre-bind.
Furthermore, If you store that state you can force the values to cycle on each press for specific toggles. i.e. this is what I done for EQ Types that have different values per band.
A rough example is as follows:-
var kkjoy_click = surface.makeButton(0, 0, 0, 0)
kkjoy_click.mSurfaceValue.mMidiBinding.setInputPort(midiInput)
.bindToControlChange(CTRL_CHAN, JOY_CLICK[0])
kkjoy_trig_click = surface.makeCustomValueVariable('kkjoy_trig_click')
kkjoy_click.mSurfaceValue.mOnProcessValueChange = function (activeDevice, value) {
kkjoy_trig_click.setProcessValue(activeDevice, 1);
}
You can see that my hardware control is defined as kkjoy_click
, but when that hardware is pressed (mOnProcessValueChange) it sets the value of the custom variable kkjoy_trig_click
, and that trigger is bound to commands, not the hardware object, i.e.:-
page.makeCommandBinding(kkjoy_trig_click, 'Preset', 'Open/Close Browser')
The value being sent is defined via .setProcessValue, example:
kkjoy_trig_click.setProcessValue(activeDevice, 1);
ā Would send value ā1ā.
kkjoy_trig_click.setProcessValue(activeDevice, 0.5);
ā Would send value ā0.5ā.
Does that make sense?
This can also be used to trigger different actions based on clockwise/anti knob movements of the same Midi CC assignments. i.e.:
var kkpage_btn = surface.makeButton(0, 0, 0, 0)
kkpage_btn.mSurfaceValue.mMidiBinding.setInputPort(midiInput)
.bindToControlChange(CTRL_CHAN, 49)
kkpage_trig_left = surface.makeCustomValueVariable('kkpage_trig_left')
kkpage_trig_right = surface.makeCustomValueVariable('kkpage_trig_right')
kkpage_btn.mSurfaceValue.mOnProcessValueChange = function (activeDevice, value) {
if (value * 127 == 127) {
kkpage_trig_left.setProcessValue(activeDevice, 1);
} else if (value * 127 == 1) {
kkpage_trig_right.setProcessValue(activeDevice, 1);
}
}
You can see based on that code that receiving a value of 127 will trigger (kkpage_trig_left
) set to ā1ā, and (kkpage_trig_right
) also set to ā1ā- even though they are received on the same CC49.
Again, those turns can be bound as separate elements once the triggers exist:-
page.makeActionBinding(kkpage_trig_left, deviceDriver.mAction.mPrevPage)
page.makeActionBinding(kkpage_trig_right, deviceDriver.mAction.mNextPage)