I would like to request a small improvement to the MIDI Remote API.
Currently, the event selectedTrack.mOnColorChange can be used to retrieve the color of the selected track. However, it does not seem to trigger when the track color is changed in Cubase (for example using Colorize → Selected Tracks or changing the track color manually).
At the moment, the event only seems to update when the track selection changes. For example, if I change a track’s color and then select another track and come back to the original one, the correct color is reported.
It would be very helpful if selectedTrack.mOnColorChange were triggered immediately whenever the track color changes, so MIDI Remote scripts and controllers can stay synchronized with track colors in real time.
I hope this can be considered for a future update.
Thanks — I hadn’t noticed that before. I see it mentioned there now.
Since that discussion mainly focuses on OSC support / track names, I thought it might still be useful to leave this here as a request related to track color updates in the MIDI Remote API (e.g. selectedTrack.mOnColorChange).
Until this is implemented (?), here’s a snippet/suggestion based on the direct access approach and the mOnIdle event of the page:
var midiremote_api = require('midiremote_api_v1')
var deviceDriver = midiremote_api.makeDeviceDriver("Test","Selected Track Color","mc")
var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("anOutput")
var detectionUnit=deviceDriver.makeDetectionUnit()
detectionUnit.detectPortPair(midiInput,midiOutput)
.expectInputNameEquals("Bome MIDI Translator 1")
.expectOutputNameEquals("Bome MIDI Translator 1")
var surface=deviceDriver.mSurface
var mapping=deviceDriver.mMapping
var page=mapping.makePage("Default")
var daSelectedTrack=page.mHostAccess.makeDirectAccess(page.mHostAccess.mTrackSelection.mMixerChannel)
var selectedColor=[-1,-1,-1,-1]
page.mOnIdle=function(activeDevice,activeMapping){
var colorArray=daSelectedTrack.getObjectColor(activeMapping,daSelectedTrack.getBaseObjectID(activeMapping))
if(colorArray[0]!=selectedColor[0] || colorArray[1]!=selectedColor[1] || colorArray[2]!=selectedColor[2] || colorArray[3]!=selectedColor[3]){
selectedColor=[colorArray[0],colorArray[1],colorArray[2],colorArray[3]]
//Send your sysex for the selected color here
console.log(colorArray.toString())
}
}
Whenever the page is “idle” we check for the color array of the selected track and if it’s different than a stored array, log (and eventually sysex it obviously). Tested here, it gets triggered whenever we change the color of the track.
Hi, thanks for the suggestion — that’s a clever workaround.
Using mOnIdle to poll getObjectColor() makes sense as a temporary solution.
In my case I’m just forwarding the RGB values externally, so polling with a small interval and only sending updates when the color actually changes should work fine.