Rearrange Inserts

Hi,

it is not possible to move inserts within a channel/track to another slot via key command or PLE - at least not to my knowledge. Is there a way to do this via MIDI Remote API script?

What I would like to do:
Move inserts one ore more slots up if they are not occupied by another insert.

Why?
If you apply a macro to open/close all insert slots at once it will abort the process once it hits an empty slot.


Hence, all subsequent inserts will not be opened/closed.
This can happen for a variety of practical reasons and it would be nice to do this in a more efficient way than dragging inserts around.

So far, I’ve only used the MIDI Remote Mapping Assistant and before I start digging into MIDI Remote API scripting I thought I’d better ask if this seems possible at all. To be honest, I wouldn’t even know where to start… :wink:

Any thoughts are much appreciated. Cheers!

1 Like

Ah HA! That explains it. Thank you.

1 Like

Yes, it’s doable, but the process of doing so is close to a nightmare concerning the async handles which will take place. Basically, one has to read the slots with an effect, and then copy/paste all the parameters involved to an empty slot (this includes the VST itself, so this is not an instant process) and obviously erase in the end whichever slots got empty. At the same time, if one gets to use the MR API, opening all the editors is close to a one line assignment if you grab the vital part of my code in this post:

However, if for whatever reasons, you’d insist to use the provided commands in Cubase, here’s a way to set up the macro so that we make sure that all of them are executed, in a MR Script:

var midiremote_api = require('midiremote_api_v1')

var deviceDriver = midiremote_api.makeDeviceDriver("Test","Execute Inserts Toggle Open","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 buttonToggle=surface.makeButton(0,0,1,1)
buttonToggle.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput)
    .bindToControlChange(0,0)

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

var customToggles=[]
for(var i=1;i<17;i++){
    var customToggle=surface.makeCustomValueVariable("customToggle"+i)
    customToggles.push(customToggle)
    var iString=i<10 ? "0"+i : i.toString()
    page.makeCommandBinding(customToggles[i-1],"Mixer","Insert "+iString+": Open/Close Editor for Selected Track/Channel").mOnValueChange=function(activeDevice,activeMapping,value,diff){
        customToggles[this.i-1].setProcessValue(activeDevice,0)
    }.bind({i})
}

buttonToggle.mSurfaceValue.mOnProcessValueChange=function(activeDevice,value,diff){
    //toggle
    if(value==1){
        for(var i=0;i<customToggles.length;i++){
            customToggles[i].setProcessValue(activeDevice,1)
        }
    }
}

This won’t break since all commands are handled in parallel.

@Thor.HOG do you use the approach of handling the inserts in the UI?

1 Like

Thanks a lot, @m.c , that’s very kind of you!

First, I got to look into this to understand how it is implemented and how it works - this might take some time. The code itself doesn’t seem to be too complicated - there’s just a lot of variables which need to be defined, first. As I said earlier, this is virgin territory to me so it’s not as clear to me as it is for someone who has long been into M.R. API scripting.

Again, thanks!

I take it that your script has no issues handling blank spots in an insert row opposed to the macro I posted above, right?

No, I meant why my macros failed sometimes - I didn’t know a blank would abort the process :slight_smile:

Nope. In reality everything is handled by Cubase and a dedicated parameter it has for this exact purpose :slight_smile: Not sure why they haven’t included it as a key command as well.

1 Like

Yes, things can go nasty with macros, breaking the flow execution. Using MR we can either do everything in parallel, or even sequentially, and then we can even add short delays between the commands.

1 Like

Sounds like macros are sitting at the children’s table with fake knives while the adults get the good stuff over at the M.R. API.

I get it that key commands and the PLE have limited resources and that you have to draw a line somewhere. A script with all its options will always be superior in its flexibility and it’s more powerful by nature.
Nevertheless, if you decide to do almost all of your tasks from a computer keyboard during mixing and mastering the degree of limitation can be disappointing in comparison. As you said, there are parameters which are already defined in Cubase so adressing them with a key command shouldn’t be too much trouble. Same applies for other basic operations.

Haha, and that’s exactly what everyone with a feature request says - do mine first, shouldn’t be a problem. As of C14, we can now open/close inserts in Cubase 14 - that’s a start and I’d better be happy about it instead of moaning away about something that’s not yet there. And there’s always the M.R. API :wink:

1 Like

Not really thinking of me this way :laughing:

2 Likes

I read this as Mr API, (which we all know is @m.c).

3 Likes

Hahaha, I like it when you joke around with me :smiley:

Hear hear!

1 Like

This certainly can make a difference. It’s why I create most of my Cubase macros in Metagrid which allows a custom delay between commands.

1 Like