Currently the mixer bank zone visibility changes can be followed by a MIDI Remote surface.
However, the update of the surface in not immediate, we need to do something, for e.g. select a track, change a volume, etc.
Not sure if this is the expected behaviour or will be changed in the future, still for now, we can workaround this in our scripts.
We can make use of the page.mOnIdle event and trick the Mixer to think that a change event is raised, by re-setting a parameter’s current value. I’ve chosen the Automation Read parameter of the selected track.
var midiremote_api = require('midiremote_api_v1')
var deviceDriver = midiremote_api.makeDeviceDriver("Test","Force Visibility Change","m.c")
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 faders=[]
var labels=[]
for(var i=0;i<8;i++){
var fader=surface.makeFader(4*i,0,4,4)
fader.mSurfaceValue.mMidiBinding
.setInputPort(midiInput)
.bindToPitchBend(i)
faders.push(fader)
var label=surface.makeLabelField(4*i,4,4,1)
labels.push(label)
labels[i].relateTo(faders[i])
}
var page=mapping.makePage("Default")
var mixer=page.mHostAccess.mMixConsole
var mixerBankZone=mixer.makeMixerBankZone("Main")
mixerBankZone.excludeInputChannels()
mixerBankZone.excludeOutputChannels()
mixerBankZone.setFollowVisibility(true) //true by default
var channels=[]
for(var i=0;i<8;i++){
var channel=mixerBankZone.makeMixerBankChannel()
channels.push(channel)
page.makeValueBinding(faders[i].mSurfaceValue,channels[i].mValue.mVolume)
}
// ******** The code for forcing the mixer to update
var selectedTrack=page.mHostAccess.mTrackSelection.mMixerChannel
var daSelectedTrack=page.mHostAccess.makeDirectAccess(selectedTrack)
var refreshRate=5 // This is for setting up the latency for updating we're comfortable with
var currentCount=0
page.mOnIdle=function(activeDevice,activeMapping){
currentCount++
if(currentCount>=refreshRate){
currentCount=0
refreshSelected(activeDevice,activeMapping)
}
}
function refreshSelected(activeDevice,activeMapping){
//setting the read automation of the selected track to its current value
//this will trick the mixer to update
var selectedTrackID=daSelectedTrack.getBaseObjectID(activeMapping)
var autoRead=daSelectedTrack.getParameterProcessValue(activeMapping,selectedTrackID,4013)
daSelectedTrack.setParameterProcessValue(activeMapping,selectedTrackID,4013,autoRead)
}
// ********
Could we call refreshSelected() after receiving a midi message, but only triggering the autoRead once (avoiding the constant polling) ? I can’t avoid the polling (the loop).
If the cc is not coming from a control set to gate, i.e. sending 0x7F (1) upon press and 0 upon release, and just sends a 0x7F, then you have to adjust the code:
var refreshButton=surface.makeCustomValueVariable("refreshButton")
refreshButton.mMidiBinding
.setInputPort(midiInput)
.bindToControlChange(0,1)
var customHostRefresh=page.mCustom.makeHostValueVariable("customHostRefresh")
page.makeValueBinding(refreshButton,customHostRefresh).mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
refreshButton.setProcessValue(activeDevice,0)
refreshSelected(activeDevice,activeMapping)
}
}
Note that it’s always beneficial to present the type of controls in use.
I have updated all my visibility shortcuts to update the visibility in stream deck, it works very well.
The only inconsistency I am experiencing is the lack of synchronicity between the track visibility changes and the bank navigation.
I wonder if you have thought in some solution for this.
As we have the “reset bank” button to go to the first bank, we could go to the bank we should go using “reset back“ and “next bank“ buttons.
I think we could calculate which bank we must activate after every visibility change if we could get:
- the total quantity of visible tracks with a valid “track index“
the first selected track with a valid “track index“
By “track index“ I mean the track number that doesn’t change with the changes of visibility, the number that each track at the side of the audio icon, instrument icon, midi icon, group icon, fx icon, sampler icon, etc. This number changes if we change the order of the tracks, but it doesn’t change if tracks are shown/hidden.
Could we get the “track index“ using DirectAccess? If we could get it, I think we should be able to change banks according to visibility changes efficiently.
I suggest that you open a new thread for this, and if the behaviour noticed is not the expected one, tag it as issue and post some screenshots of your mixer banks, so that we can all see exactly what’s happening.