Is It Possible to Set Track Routing to a Specific Target Track Using M4L?
Hi everyone,
I'm trying to create a M4L device with a button that, when pressed, sets the output routing of the selected track (the track containing this device) to a custom track named "MASTER" . In my project template, this custom "MASTER" track is always the first track (ID 0).
I’ve tried various methods, including using get available_output_routing_types
to capture the routing option for "MASTER" and attempting set available_output_routing_types 0
, but I’m running into issues with getting it to reliably set to this target track.
Is there a straightforward way in M4L to set the output routing of a track to a specific target track?
Current Patch Setup:
Thanks!
There isn't a direct go-between from LOM id (e.g. a Track) to routing input/outputs. The best you can do is sift through the list of available output routing types and find the index which has the matching name.
These days you can use the [live.routing] object for a lot of this API stuff, I think.
Hi @tyler mazaika, thanks for the message.
After exploring the forum, I found a related thread where user named, "broc," provided a script that almost does what I need. I made slight modifications so that it targets the selected track rather than a specific one.
Here’s what broc’s original version does versus what I am trying to achieve:
Current Script Behavior: When I click the button, the script updates the
umenu
(dropdown menu) with available output routing types for the selected track. Then, I need to manually select the routing option from thisumenu
, and only after that does it set the output routing for the selected track.What I Want: I want to simplify this process. Instead of manually selecting a routing option from the
umenu
, I want it so that when I click the button, it automatically sets the output routing of the selected track to a specific target track called "MASTER" (which is always the first track, ID 0, in my template). This should happen directly without any manual selection from theumenu
.
For reference, here’s the compressed version of my current script that uses broc’s approach but is modified to target the selected track:
Could you help me with this?
This would be the least work mod for your patch
could be simplified though ...
@SOURCE AUDIO, thanks alot. In the meantime, I tried working directly with a num ID, omitting the umenu
and sending the track number directly. However, I prefer your method, as it reliably targets the MASTER track regardless of its position.
Thanks again... As you said, there might be faster ways or more simplified, but this way is perfect for what I need. 😊
same approach, only with less objects
@Source Audio, thanks alot for this updated version. What you provided earlier has already helped me make significant progress in advancing further into my m4l device , which hopfully will serve my entire Ableton Project Custom Template.