Is there a way to detect that a track, or bank has changed?
I can come up with some hacks that would do it, but it seems like that would be a thing?
Does anyone know?
Use the OnTitleChange event on a fader element.
This is from my CC121 script where I created a hidden fader just for this detection.
Hope this helps
surfaceElements.fader = deviceDriver.mSurface.makeFader(0,0,0,0)
surfaceElements.fader.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToControlChange (0, 0xFF) // dummy
page_preSecion.makeValueBinding(surfaceElements.fader.mSurfaceValue, page_preSecion_hostSelectedTrackChannel.mValue.mVolume)
surfaceElements.fader.mSurfaceValue.mOnTitleChange = function (context, value, units) {
if (Object.keys(value).length == 0)
{
// if the value has no object, we have no binding and therefor we are e.g. on a folder channel in the project windows
// in this case we set it to 'empty'
current_channel = 'empty'
}
else
{
current_channel = value
}
}
2 Likes