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

Apr 16, 2012 at 11:35am

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

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?

#63007
Apr 16, 2012 at 11:37am

Hmm, just googled

“max for live” get track number

and found: http://www.cycling74.com/forums/topic.php?id=33310

I’ll check that first.

#227413
Apr 16, 2012 at 12:04pm

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

http://cycling74.com/forums/topic.php?id=39316#post-191193

#227414
Apr 16, 2012 at 5:23pm

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

#227415
Nov 28, 2013 at 1:09am

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

Just a hint would be enough I guess.

#273997
Nov 28, 2013 at 7:17am

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.

#274028
Nov 28, 2013 at 8:23am

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…

#274033
Nov 28, 2013 at 8:38am

http://cycling74.com/docs/max6/dynamic/c74_docs.html#live_api_overview

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

#274035
Nov 29, 2013 at 4:13am

Thanks! All is clear now :)

#274107

You must be logged in to reply to this topic.