Thanks a lot @m.c
Tomorrow I will try both options.
I have been spending several hours today trying to write a code to receive the pan value of the selected track after sending a midi cc, but all my attempts have been a failure.
This is the code I am using for receiving the name and the pan value of the selected track:
// get name of the selected track when track name changes OR cc is received
var selectedTrackName = ""
var selectedTrackName_ID = 0x1A
var selectedTrackName_consolePrefix = "Selected Track | Name: "
var selectedTrackNameObject = deviceDriver.mSurface.makeCustomValueVariable('selectedTrackNameObject')
selectedTrackNameObject.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToControlChange (0, 11) // channel 1, cc 11
selectedTrackNameObject.mOnTitleChange = function(activeDevice, objectTitle, valueTitle) {
selectedTrackName = objectTitle
}
selectedTrackNameObject.mOnProcessValueChange=function(activeDevice,value,diff){
if(value==1){
sendSysexString(activeDevice,selectedTrackName,selectedTrackName_ID,selectedTrackName_consolePrefix)
}
}
// get panorama of the selected track when pan value changes OR cc is received
var selectedTrackPanorama = ""
var selectedTrackPanorama_ID = 0x1B
var selectedTrackPanorama_consolePrefix = "Selected Track | Panorama: "
var selectedTrackPanoramaObject = deviceDriver.mSurface.makeCustomValueVariable('selectedTrackPanoramaObject')
selectedTrackPanoramaObject.mMidiBinding
.setInputPort(midiInput)
.setOutputPort(midiOutput)
.bindToControlChange (0, 12) // channel 1, cc 12
selectedTrackPanoramaObject.mOnDisplayValueChange = function(activeDevice, objectTitle, valueTitle) {
selectedTrackPanorama = objectTitle
}
selectedTrackPanoramaObject.mOnProcessValueChange=function(activeDevice,value,diff){
sendSysexString(activeDevice,selectedTrackName,selectedTrackName_ID,selectedTrackName_consolePrefix)
}
// send sysex and show log
function sendSysexString(activeDevice,receivedString,sysexID,consolePrefix){
var sysexMessage=[0xF0,sysexID].concat(receivedString.split('').map(function(c){return c.charCodeAt(0)})).concat([0xF7])
midiOutput.sendMidi(activeDevice,sysexMessage)
console.log(consolePrefix + receivedString)
}
var hostSelectedTrackChannel = page.mHostAccess.mTrackSelection.mMixerChannel
page.makeValueBinding(selectedTrackNameObject, hostSelectedTrackChannel.mValue.mSelected)
page.makeValueBinding(selectedTrackPanoramaObject, hostSelectedTrackChannel.mValue.mPan)
When I send channel 1, cc 11, value 127 the name of the selected track is sent by sysex and it’s shown correctly in the console.
But when I send channel 1, cc 12, value 127 the panorama of the selected track is moved to R, sending the sysex “R” and showing the “R” pan in the console.
I have tried a lot of things but I can’t stop the panorama from always changing to R.
How should I do this (if it’s possible) ?