Forums > Max For Live

Live API – getting the track that my device is placed on

Apr 16 2012 | 11:35 am

I know that using the live.path object I can get any track by number, e.g.

live_set tracks 0
live_set tracks 1
live_set tracks 2

But what if I want my device to get the track it has been placed on? I cannot hard-code any particular track number, I need to get it dynamically. How do I do this?

Apr 16 2012 | 11:37 am

Hmm, just googled

"max for live" get track number

and found:

I’ll check that first.

Apr 16 2012 | 12:04 pm

Check out this post for a solution (you only need the stuff on the left of the patcher, ending at ‘zl.slice 4’.

Apr 16 2012 | 5:23 pm

Thanks Jeremy. That’s quite similar to the solution I found on the link I posted above.

Nov 28 2013 | 1:09 am

I need to figure this out too, but both links are dead…

Just a hint would be enough I guess.

Nov 28 2013 | 7:17 am

The easiest way to get the current track is to use [live.path this_device canonical_parent]

The canonical parent of a device is always the track it is placed on, according to the docs.

Nov 28 2013 | 8:23 am

Ah yes now I remember I’ve use that before :) Where is this documented though? The LOM reference only lists live_set, live_app and control_surface as path starting points…

Nov 28 2013 | 8:38 am

See under the headings ‘Root objects‘ and ‘Canonical Parent‘.

Nov 29 2013 | 4:13 am

Thanks! All is clear now :)

Viewing 9 posts - 1 through 9 (of 9 total)

Forums > Max For Live