Need a PLE to enable a track (only enable, not enable/disable toggle)

Hello, I have a macro that unhide a track by a specific name, select it, and I would like to auto enable it as a 3rd command in the macro. But I want when re using this macro, after track is visible and enabled, to just select it without disabling it.

Unhiding a visible track do nothing, so that’s good
but using the toggle enable/disable audio track on an enabled track disable it

any way I can solve this ?

sorry I dont understand, if you have a track enabled why would you apply this macro to it?

I want a macro that :

  • if a track is enabled : select it
  • if a track is disabled : show it, select it, enable it

I am using this macro in an external custom software that select a track in my template by name, for other purposes (switching articulation on iPad etc.)

I think in Cubase you´d need 2 macros.

even with 2 macros, how can I send the same message from my software to cubase, and trigger one macro or the other based on wether a track is enabled ? do you know if the cubase midi api remote give away that information about enabled/disabled state ? I know disabled tracks are invisible in the cubase api remote directaccess

You can use PLE presets to trigger other PLE presets.

I’m not in front of Cubase now, but I imagine you need one preset to test for the condition (enabled or disabled track) which then triggers the other preset which either unhides or enables and unhides the track.

is triggering a PLE preset in the event transform actions middle section of the PLE ? I don’t see it as a possible transform action

Use the Select function in the first PLE, and in the post-process commands you can trigger the next PLE preset.

but isn’t the post process commands firing despite the conditions being matched or not?

since the goal is : “select the track with name equal to x, and if disabled, enable it”

in both scenario the track has to be selected, so selecting alone cannot be the filter

This can get complex.

I won’t get into describing it, but I will share screenshots:

Trigger the tmp_PLE_2, this will handle the rest PLEs.

I think something is not working as expected: in a PLE I put: a track is property selected and property disabled then do something in the middle action field but it performs the transform whether the track is disabled or enabled…

phew!

ok I get the prefix trick, but what would this macro accomplish on a track that’s enabled and visible, and enabled and hidden ?

I am trying to send one command to cubase to select a track and enable it if it’s disabled, and I am only allowed to send one command, because my 3rd party software cannot guess wether a track is enabled or not (unless midi remote api give this information but I didn’t find it. The other solution is to get the full track list of enabled tracks using direct access and cache them, and use periodic pooling to keep my cache updated. But if there’s a simple way like using just one macro I am all in

It will reselect it.

It won’t do anything in this case. You can extend the logic for handling hidden/enabled tracks as well.

nice, so I’d just need to create a tmp_PLE_1a and tmp_PLE_1b. one for enabled and one for disabled track, and just always trigger both at the same time, one of them will always silently fail and the other will trigger the sequence.

So that mean 3 unique PLE presets per track I want to handle

correct ?

Ok I found a way. with the midi api remote I was able to fetch all the enabled track list at once, so filtering Is easy using this method. since you are the remote api pro, you wouldn’t know a way to expose the disabled track using the api somehow ?

We need to understand that there is the “Project” object, and the “Mixer” object. The latter is what we see in the mixConsole and is just a subset (not accurate term) of the Project. This means that disabled tracks are out of reach using the API.

We CAN get the IDs of channels that are no longer part of the “Mixer” object. But then, we have no way of bringing them back (for example selecting them, or re-enabling them or whatever else).

Here’s how we can get get the inactive channels:

var channels=[]
var channelsInactive=[]
var daMixer=page.mHostAccess.makeDirectAccess(page.mHostAccess.mMixConsole)
...
page.mOnActivate=function(activeDevice,activeMapping){
    daMixer.activate(activeMapping)
    channels=[]
    channelsInactive=[]
    var mixerID=daMixer.getBaseObjectID(activeMapping)
    var channelsCount=daMixer.getNumberOfChildObjects(activeMapping,mixerID)
    if(channelsCount>0){
        for(var i=0;i<channelsCount-1;i++){
            var channelID=daMixer.getChildObjectID(activeMapping,mixerID,i)
            channels.push(channelID)
        }
    }
    
}

page.mOnDeactivate=function(activeDevice,activeMapping){
    daMixer.deactivate(activeMapping)
}
...
daMixer.mOnObjectChange=function(activeDevice,activeMapping,objectID){
    if(objectID==daMixer.getBaseObjectID(activeMapping)) return 
    var channelIndexInactive=channelsInactive.indexOf(objectID)
    if(channelIndexInactive!=-1){
        channelsInactive.splice(channelIndexInactive,1)
        if(channels.indexOf(objectID)==-1){
            channels.push(objectID)
        }
    } else {
        var channelIndex=channels.indexOf(objectID)
        if(channelIndex==-1){
            var channelMixerIndex=daMixer.getMixerChannelIndex(activeMapping,objectID)
            console.log("channelMixerIndex="+channelMixerIndex)
            if(channelMixerIndex!=-1){
                channels.push(objectID)
            }
        }
    }
}

daMixer.mOnObjectWillBeRemoved=function(activeDevice,activeMapping,objectID){
    if(objectID==daMixer.getBaseObjectID(activeMapping)) return 
    var channelIndex=channels.indexOf(objectID)
    if(channelIndex!=-1){
        channels.splice(channelIndex,1)
        if(channelsInactive.indexOf(objectID)==-1){
            channelsInactive.push(objectID)
        }
    }
}

Have a look at the mOnObjectWillBeRemoved function. This is where we know that a channel is no longer part of the mixer. HOWEVER, the sad truth is that this will get triggered not just when we disable a track, but also when we delete it. We cannot distinguish. BUT, say for a moment that we workaround this somehow. And now we have the array channelsInactive, and we can even build an object for properly querying for channel ID by track name. Fine. There is no way (currently) to bring it back, using the API.

This is a reason I initially posted the PLE-based solution and “ignored” your question about direct access. I had to :wink:

Thank you for your help! you have no idea how much of a break thought I did in my software because of your advices. I have been stuck on this issue for months and months