You can try adding a subPage for getting things back to normal:
var customAssignOn=surface.makeCustomValueVariable("assignOn")
var customAssignOff=surface.makeCustomValueVariable("assignOff")
btnAssign.mSurfaceValue.mOnProcessValueChange=function(activeDevice,value,diff){
if(value==1){
var customAssignOnPrevious=customAssignOn.getProcessValue(activeDevice)
customAssignOn.setProcessValue(activeDevice,1-customAssignOnPrevious)
customAssignOff.setProcessValue(activeDevice,customAssignOnPrevious)
}
}
var eqBandsSelectAndEnableSubPageArea=page.makeSubPageArea("eqBandsSelectAndEnableSubPageArea")
var eqBandsSelectSubPage=eqBandsSelectAndEnableSubPageArea.makeSubPage("eqBandsSelectSubPage")
var eqBandsEnableSubPage=eqBandsSelectAndEnableSubPageArea.makeSubPage("eqBandsEnableSubPage")
page.makeActionBinding(customAssignOn,eqBandsEnableSubPage.mAction.mActivate).setSubPage(eqBandsSelectSubPage)
page.makeActionBinding(customAssignOff,eqBandsSelectSubPage.mAction.mActivate).setSubPage(eqBandsEnableSubPage)
You should then assign your action binding for changing eqBand subPage in the eqBandsSelectSubPage, while setting value binding to your eqBand “On” hostValue in the eqBandsEnableSubPage subPage.
You can think of a customValueVariable as a a custom element of your controller (as knobs, faders etc) while the custom hostValueVariable is like the values exposed by the DAW (transports, volumes, etc).
In the snippet earlier, I show one usage of the customValue vars. We can manipulate an element of our controller the way we like, especially when it’s a button. When it’s not a button, things can get complicated.
The hostValueVariable is of usage in some cases, as for example, when we want in a specific subPage that a specific control doesn’t do anything at all. We bind it to a hostValueVariable.
Another, more powerful usage, is to get the instance of the activeMapping inside the mOnValueChange, and trigger things, example:
var aSubPageArea=page.makeSubPageArea("aSubPageArea")
var subPageOne=aSubPageArea.makeSubPage("one")
var subPageTwo=aSubPageArea.makeSubPage("two")
var customSurfaceVar=surface.makeCustomValueVariable("aCustomSurfaceVar")
var customHostVar=page.mCustom.makeHostValueVariable("aCustomHostVar")
page.makeValueBinding(customSurfaceVar,customHostVar).mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
subPageOne.mAction.mActivate.trigger(activeMapping)
} else {
subPageTwo.mAction.mActivate.trigger(activeMapping)
}
}