How to get track number from inside the track.

Polynomial_B's icon

Polynomial_B

May 10, 2011, 3:23 PM

I have many tracks with the same max4live device in them. I need to know for each device the id of the proper track. Each device must send the number of his track to a message "path live_set tracks $1". Does exist a message witch give the number of the track where it belong? For example: can I ask to live.path something like "this track?" and receive back the track number?
I need it to build a device that can be placed in every tracks but it must knows the number of its track.
Could anybody help me?
thx in advance..

Ben Bracken's icon

Ben Bracken

May 10, 2011, 5:16 PM

Max Patch
Copy patch and select New From Clipboard in Max.

You can use 'path this_device' to figure out the track that the device is on. Here is one way to do it:

Spip's icon

Spip

May 10, 2011, 6:11 PM

Thanks a lot ! I was looking for the same thing…

Is there a place where we can find all the attributes, messages and other needed informations for the API objects ?
A sort of thesaurus or are the LOM reference page and M4L tutorials the only ones ?
For example, in another thread, I was asking something related to midi channel of a live track. The secret (thanks to broc for the answer) was the "Ch." to put in the message box. I can't find it in the two pages mentioned above.

Ben Bracken's icon

Ben Bracken

May 10, 2011, 6:33 PM

Everything should be in either the LOM ref or the individual object ref entries. In Max, just go to Help->Max For Live. You can get to all the objects under Reference->Objects A-Z.

Let us know if you aren't finding what you are looking for.

-Ben

Spip's icon

Spip

May 10, 2011, 7:38 PM

Thanks for your answer.

Here is what I can not find : the upper part of the patch. How is it possible to know that "prepend Ch." was needed. (particularly Ch.)

2233.Screenshot20110510at21.35.33.png
png
Ben Bracken's icon

Ben Bracken

May 10, 2011, 8:18 PM

This will just depend on what the available routings are. I believe that "Ch." convention is used for midi channel input/output, as it appears in the channel strip.

-Ben

Polynomial_B's icon

Polynomial_B

May 11, 2011, 12:30 AM

Thanks you very much. I'm not lucky today: live.object: get path: error calculating the path. This is the error that the live.object in your patch gives to me and I can't understand the why.

Polynomial_B's icon

Polynomial_B

May 11, 2011, 12:38 AM

The problem was that my device was inside a drum rack. If I put it outside it works.

ShelLuser's icon

ShelLuser

May 11, 2011, 3:11 PM

The easiest solution for your problem is the "this_device" root object (as mentioned above) but in comparison with the "canonical_parent" path. This child will always point to the previous (parent) class in the hierarchy.

So when looking at the LOM you'll notice that the parent of a device is a track.

As such simply use: "path this_device canonical_parent" which will point at the track the device is on.

As you noticed yourself things change when you're inside a rack; that's because the physical location of the device is now no longer the track, but instead a Chain within the rack.

To get out of a chain you could use: "path this_device canonical_parent canonical_parent canonical_parent". You actually need 3 "hops": one to go to the Chain class, one to go to the Device class (the Rack device itself) and finally one to go to the Track class.

To answer your other question... Stuff like "canonical_parent" is explained in the Live API overview.

4trax's icon

4trax

Dec 21, 2012, 12:43 PM

Great thanks for this - I am working on a similar problem.

snaper's icon

snaper

Mar 16, 2014, 6:11 AM

Is it possible to do this with live.observer?