Opening All Insert Slots And/Or Instrument Plugin upon changing (the selected) track

Just for CB 13 (Latest) and CB14, won’t work on earlier versions.

Here’s a MIDI remote script that does what the title suggests:

When we change the selected track (in the mixer, but also in the project window if we have Preferences→Editing→Project & MixConsole→Sync Selection in Project Window and MixConsole enabled) all plugin windows are closed and then all the inserts slots plugin windows of the newly selected track will open. At the same time the instrument plugin window will open. BOTH these options can be treated separately if needed, by directly altering the variables settingActivateOpen and settingActivatePluginOpen in the script, by setting them to true or false based on whether we want to open plugin windows and/or the instrument plugin window. We can even dynamically toggle these variables, I have set MIDI CC 0 and 1 (Channel 0) for toggling them. One can always edit the MIDI Port names to fit the ones they want, and also the MIDI CC message involved.

The state of these settings are reflected in the MIDI Remote Surface Window, by lamps. So for example, in the following screenshot, we can see both enabled:

And when for example we disable the auto open of the instrument plugin window:

Here’s the snippet for anyone interested in this:

// Opening all insert slots and/or instrument plugin of selected track

var midiremote_api = require('midiremote_api_v1')

var deviceDriver = midiremote_api.makeDeviceDriver("Test","Open Inserts Selected","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 customOpenPlugins=surface.makeCustomValueVariable("customOpenPlugins")
customOpenPlugins.mMidiBinding
    .setInputPort(midiInput)
    .bindToControlChange(0,0)

var customOpenPluginWindow=surface.makeCustomValueVariable("customOpenPluginWindow")
customOpenPluginWindow.mMidiBinding
    .setInputPort(midiInput)
    .bindToControlChange(0,1)

var labelOpenPlugins=surface.makeLabelField(0,0,8,1)
var lampOpenPlugins=surface.makeLamp(8,0,1,1)

var labelOpenPluginWindow=surface.makeLabelField(0,1,8,1)
var lampOpenPluginWindow=surface.makeLamp(8,1,1,1)


var closeAllPluginsCustomVar=surface.makeCustomValueVariable("closeAllPluginsCustomVar")
var openPluginsSelectedTrackVar=surface.makeCustomValueVariable("openPluginsSelectedTrackVar")
var openPluginWindowSelectedTrackVar=surface.makeCustomValueVariable("openPluginWindowSelectedTrackVar")

var page=mapping.makePage("Open Inserts")

page.setLabelFieldText(labelOpenPlugins,"Plugins Open State")

page.setLabelFieldText(labelOpenPluginWindow,"Plugin Window Open State")

var selectedTrack=page.mHostAccess.mTrackSelection.mMixerChannel 
var daSelectedTrack=page.mHostAccess.makeDirectAccess(selectedTrack)

page.mOnActivate=function(activeDevice,activeMapping){

    daSelectedTrack.activate(activeMapping)
    
    lampOpenPluginWindow.mSurfaceValue.setProcessValue(activeDevice,settingActivatePluginOpen ? 1 : 0)
    
    lampOpenPlugins.mSurfaceValue.setProcessValue(activeDevice,settingActivateOpen? 1 : 0)

}

page.mOnDeactivate=function(activeDevice,activeMapping){

    daSelectedTrack.deactivate(activeMapping)

}

var settingActivateOpen=true 
var settingActivatePluginOpen=true 

customOpenPlugins.mOnProcessValueChange=function(activeDevice,value,diff){

    if(value==1){

        settingActivateOpen=!settingActivateOpen

        lampOpenPlugins.mSurfaceValue.setProcessValue(activeDevice,settingActivateOpen ? 1 :0)

    }

}

customOpenPluginWindow.mOnProcessValueChange=function(activeDevice,value,diff){

    if(value==1){

        settingActivatePluginOpen=!settingActivatePluginOpen

        lampOpenPluginWindow.mSurfaceValue.setProcessValue(activeDevice,settingActivatePluginOpen ? 1 :0)

    }

}

page.makeCommandBinding(closeAllPluginsCustomVar,'Windows', 'Close All Plug-in Windows').mOnValueChange=function(activeDevice,activeMapping,value,diff){
    
    if(value==1){

        closeAllPluginsCustomVar.setProcessValue(activeDevice,0)

        if(settingActivateOpen){

            openPluginsSelectedTrackVar.setProcessValue(activeDevice,1)

        }

        if(settingActivatePluginOpen){

            openPluginWindowSelectedTrackVar.setProcessValue(activeDevice,1)

        }

    }

}

page.makeValueBinding(openPluginWindowSelectedTrackVar,selectedTrack.mInstrumentPluginSlot.mEdit)

var customHostOpenPlugins=page.mCustom.makeHostValueVariable("customHostOpenPlugins")

page.makeValueBinding(openPluginsSelectedTrackVar,customHostOpenPlugins).mOnValueChange=function(activeDevice,activeMapping,value,diff){

    if(value==1){

        if(selectedObjectID>-1){

            daSelectedTrack.setParameterProcessValue(activeMapping,selectedObjectID,4096,1)

        }

        openPluginsSelectedTrackVar.setProcessValue(activeDevice,0)

    }
    
}

var selectedObjectID=0

daSelectedTrack.mOnObjectChange=function(activeDevice,activeMapping,objectID){

    if(settingActivateOpen==false && settingActivatePluginOpen==false) return 

    var selected=daSelectedTrack.getParameterProcessValue(activeMapping,objectID,4000)

    if(selected==1 && objectID!=selectedObjectID){
            
        selectedObjectID=objectID
        closeAllPluginsCustomVar.setProcessValue(activeDevice,1)
        
    }

}

And here’s the midiRemote installation file:

Test_Open Inserts Selected.midiremote (1.9 KB)

A short demonstration, while selecting a track either by mouse click or cursors up/down:

8 Likes

“Great! Could you also make the same thing work with instrument tracks, and another version that only opens the instrument tracks without the plugins?”

1 Like

Sure, just updated the post with a new midiRemote file, and the description for both cases.

32 / 5 000

Great class, thank you very much!

I’m not very comfortable with script editing, but I managed to make the modification so that only the instruments open. However, my problem is that when I quit Cubase and restart, the script disappears and I have to add it again each time. I remember having a similar issue with your script for the MK3, but I don’t recall what needs to be done. Could you clarify this for me? By the way, the option to open instruments when clicking on a track should really be built into Cubase

Yes, you have to edit the lines for the MIDI Input and Output ports, and set their values exactly to the ones you see (and want to use) in your Studio→Studio Setup→MIDI Port Setup.
The lines to be edited are these:

detectionUnit.detectPortPair(midiInput, midiOutput)
    .expectInputNameEquals("Bome MIDI Translator 1")
    .expectOutputNameEquals("Bome MIDI Translator 1")

So, for example, here are my MIDI Ports at my dev setup here:

Say that I want to use as MIDI Input the port “loopMIDI Port 1”. I have to change the line for the inputName to this:

.expectInputNameEquals("loopMIDI Port 1")

Sure, it would be a nice addition. Though to be honest, after getting into the MIDI Remotes, and especially the MK3, I don’t even open plugin windows any more, nor channel settings or the mix console :slight_smile:

This is great, it works!
Thank you so much for sharing, it’s awesome.
I spend my days working in Cubase and I really love this software, which I know quite well now. But I have no knowledge of API programming. :wink:
Anyway, your tests and research are really interesting.
Thanks a lot for the quick response

1 Like

Ah yes, definitely!!
I still need it anyway, if only because not everything is available through the script functions in certain plugins

This is interesting. Aren’t these parameters exposed to Cubase and then can be asisgned to our parameters zones via the Remote control editor?

Overall, everything is working great, and I really don’t want to cast any doubt on your script—it’s fantastic.
That said, there are a couple of things I’d love to be able to adjust in the MK3 script.
First, the tap tempo: it’s a bit too easy to hit it by accident, which isn’t very practical. Ideally, I’d like to disable it completely, or maybe have it reassigned to a page like ‘com set 1’ instead.
Another improvement I’d love to see is in the Cubase channel strip. It would be amazing if, directly from your script, we could load the gate, compressor, etc., and start using them right away. At the moment, if I don’t load them manually with the mouse, they can’t be activated—or maybe I missed something? Do you see what I mean

Just like with the plugins, it would be great to have a function that allows inserting a plugin into the desired slot directly from the controller

Both are doable when having the script to its full version, instead of the stripped down one. And changing the vst in the instrument slot. These functions are inherited from the Mackie protocol, and this is why we (for now) need the Mackie setup suggested in the full version.
That being said, such questions, would fit more to the dedicated thread for the script :slight_smile:

That is a very cool function. It’s making me regret I’m still using Cubase 12.

Is there a way to turn that functionality on and off? I could see it becoming rather hectic while scrolling up and down the tracks. Also, I am not scripting expert so I can’t tell if there’s anything written in your script, but what happens when you select multiple tracks? Just wondering.

Hi, yes we can enable/disable these functions by using dedicated midi Ccs or of course by compelety enabling disabling the script.
Not sure about how it will act on multiple selections, will check later and report back :slight_smile:

Just checked it, looks like that when we select multiple tracks (having one already selected) nothing happens. I think this is OK, since opening all the inserts of the selected tracks together might be messy.

Just a FYI cause this is a slightly different approach: If you open all plugins via key commands packed into a macro it’s the last selected track whenever multiple tracks are selected. That works for me, too.

1 Like

Hi. Is this possible to use note instead of cc message?

Of course :slight_smile:

Thanks. So something like this should be enough I guess