OK, so I’ve prepared a test script. BOTH surfaceValues binded to mVolume and mSelected of a mixerBankZone channel, got triggered ONLY upon the page’s activation. I somehow think that they’ve took this functionality out maybe because it would be an overkill (?) for the performance. BUT I mostly suspect that this is the expected behaviour, since the surfaceValues functions do not include the activeMapping argument. That means - again maybe - that they can deal with their context (which is the activeDevice) but not with a page (which is the activeMapping).
Anyway, just speculations, here’s the test:
var midiremote_api = require('midiremote_api_v1')
var driver=midiremote_api.makeDeviceDriver("testscript","testScript","someone")
var midiIn=driver.mPorts.makeMidiInput("midiIn")
var midiOut=driver.mPorts.makeMidiOutput("midiOut")
driver.makeDetectionUnit().detectPortPair(midiIn,midiOut)
.expectInputNameContains("MIDI")
.expectInputNameContains("MIDI")
var surface=driver.mSurface
var faders=[]
var selectButtons=[]
for(var faderIndex=0;faderIndex<8;faderIndex++){
var fader=surface.makeFader(faderIndex,0,1,5)
fader.mSurfaceValue.mMidiBinding.setInputPort(midiIn).setOutputPort(midiOut).bindToPitchBend(faderIndex)
faders.push(fader)
var selectButton=surface.makeButton(faderIndex,5,1,1)
selectButton.mSurfaceValue.mMidiBinding.setInputPort(midiIn).setOutputPort(midiOut).bindToNote(0,24+faderIndex)
selectButtons.push(selectButton)
}
var page=driver.mMapping.makePage("page")
var mixerBankZone=page.mHostAccess.mMixConsole.makeMixerBankZone("mixerBankZone")
mixerBankZone.excludeInputChannels()
mixerBankZone.excludeOutputChannels()
for(var channelIndex=0;channelIndex<8;channelIndex++){
var mixerBankChannel=mixerBankZone.makeMixerBankChannel()
var faderSurfaceValue=faders[channelIndex].mSurfaceValue
var buttonSurfaceValue=selectButtons[channelIndex].mSurfaceValue
page.makeValueBinding(faderSurfaceValue,mixerBankChannel.mValue.mVolume)
page.makeValueBinding(buttonSurfaceValue,mixerBankChannel.mValue.mSelected)
//both surfaceValues triggered ONLY upon page's activation
//********************************************************
faderSurfaceValue.mOnColorChange=(function(activeDevice,r,g,b,a,active){
console.log("SURFACE mVolume-mOnColor received on index"+this.channelIndex+": r="+r+", g="+g+", b="+b+", active="+active)
}).bind({channelIndex})
buttonSurfaceValue.mOnColorChange=(function(activeDevice,r,g,b,a,active){
console.log("SURFACE mSelect-mOnColor received on index"+this.channelIndex+": r="+r+", g="+g+", b="+b+", active="+active)
}).bind({channelIndex})
//********************************************************
//These get triggered as expected
mixerBankChannel.mValue.mVolume.mOnColorChange=(function(activeDevice,activeMapping,r,g,b,a,active){
console.log("mVolume-mOnColor received on index"+this.channelIndex+": r="+r+", g="+g+", b="+b+", active="+active)
}).bind({channelIndex})
mixerBankChannel.mValue.mSelected.mOnColorChange=(function(activeDevice,activeMapping,r,g,b,a,active){
console.log("mSelect-mOnColor received on index"+this.channelIndex+": r="+r+", g="+g+", b="+b+", active="+active)
}).bind({channelIndex})
}
page.mOnActivate=function(activeDevice){
var faderSurfaceValue=faders[0].mSurfaceValue
faderSurfaceValue.mOnColorChange=function(activeDevice,r,g,b,a,active){
console.log("ON ACTIVATE SURFACE mVolume-mOnColor received: r="+r+", g="+g+", b="+b+", active="+active)
}
}