Lua: editor mixer strip

In Lua, is there any way to determine which strip is the one whose mixer is being shown in the Editor? I’ll call this the EMS (editor mixer strip), not sure if there’s a proper name for it.

Alternatively, in a single-fader controller scenario, is there any way in Lua to determine which strip this controller is currently controlling?

If one or more strips are selected then the EMS will be whichever strip was most recently added to the selection. In which case the following gives the EMS’ route:
Editor:get_selection().tracks:route_list():back()
All good.

However, if the EMS’s strip is now removed from the selection then the EMS is still showing that same strip, so the above script is now giving the wrong answer.

I ask because it is the EMS that a single-fader controller controls. When I have multiple strips selected my controller is only going to be controlling one of them, and I have a script trying to tell me which strip that is. BUT in this remove-EMS-from-selection scenario the controller now controls nothing at all, presumably because the strip it thinks it should be controlling is not in the selection and so is not a valid target for controlling. In which case I’d like my script to be reporting back “none”, which I could determine by checking whether the EMS is in the selection list, but for that I first need to determine what the EMS is.

For example…

  1. Select the Guitar track. Guitar is now the EMS and the controller controls it.
  2. CTRL+click on Bass track to add to the selection. Bass is now the EMS and the controller controls it.
  3. CTRL+click on Base track again to remove it from the selection. EMS is still Bass, controller controls nothing, and the script above returns the Guitar track.

It is even more involved. e.g. selecting an automation lane shows the parent track in the editor-mixer…

If you wait until tomorrow’s nightly build ( 8.2-142) or soon upcoming 8.3, you can use either of the following:

Editor:current_mixer_stripable()
Session:selection():first_selected_stripable()

keep in mind that both may return a NULL reference (check with :isnil()).

1 Like

Perfect! Thank you Robin.

I tried the nightly and either of those methods will do the job nicely, albeit in different ways. In a remove-EMS-from-selection scenario current_mixer_stripable() indeed returns the Editor mixer strip, while first_selected_stripable() returns nil (despite other strips still being in the selection).

It is even more involved. e.g. selecting an automation lane shows the parent track in the editor-mixer

Ah yes, good point. Also VCAs are a different beast as they’re not shown in the Editor mixer.

Yes, they are not identical.

first_selected_stripable is the most recently selected strip. If you remove that from the selection (or remove the track), it becomes unset, even if other strips may be selected.This is used by all control surfaces.

The editor-mixer is more forgiving. There is a fallback to always show some strip, regardless of selection. If you remove all selected tracks, the editor mixer will show some other track or bus (which is not selected). If you remove all tracks, the editor-mixer will fall back to show the master-bus. Only in a session without master-bus, the editor-mixer will hide itself when all tracks are removed.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.