Track output routing "audio to" automatic swap

lenfant2glace's icon

Hi all,

I am really new to max and quite new to Live, did 3 little patches.
Now I'd like to use Live API for doing this:
Whenever I swap tracks (change the order of tracks), I want that all tracks to have its own "Audio To" set equal to his number.
For example, let say I have a 3 tracks live set.
"1 Track1" has its "Audio To" set on "Ext. Out" "1"
"2 Track2" has its "Audio To" set on "Ext. Out" "2"
"3 Track3" has its "Audio To" set on "Ext. Out" "3"
Now if I displace "3 Track3" and place it right on the left of "1 Track1", it becomes "2 Track3" and "2 Track2" becomes "3 Track2".
And the patch is keeping "Audio to" equal to track number like this:
"1 Track1" has its "Audio To" set on "Ext. Out" "1"
"2 Track3" has its "Audio To" set on "Ext. Out" "2"
"3 Track2" has its "Audio To" set on "Ext. Out" "3"

From what I read in the Live Object Model, it seems possible to me.

Any help would be greatly appreciated.

JM

lenfant2glace's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Part of the solution is there:
this patch let you know "which track I am on?" (from https://cycling74.com/forums/how-to-get-track-number-from-inside-the-track/ )

test_track_swap.amxd
amxd
lenfant2glace's icon

Another part of the solution, changing track output routing (Audio To) is there.

M4L-Tom-Cosm-Toggle-Router-1.0.amxd
amxd
lenfant2glace's icon

Here is the state of the patch now. Close to what it should do.
It's hard to cope with that real time paradigm. Need to set some bangs the right way.
It's hard to figure out what type of object or data are exchange by the boxes. It gets me confused sometimes.

test_track_swap.amxd
amxd
lenfant2glace's icon

I am trying to figure out how to set current_output_routing to "Ext. Out x".
I can set on "Ext. Out" 1/2 because when I set current_output_routing to "Ext. Out", it set on 1/2 by default but can't on the channel "Ext. Out" 9 for instance.

Here is attached the patch (latest version).

test_track_swap1.amxd
amxd
lenfant2glace's icon

ok I got it : set current_output_sub_routing x

Here is attached the final patch if anyone is interested.

test_track_swap2.amxd
amxd