Forums > Max For Live

How to get track number from inside the track.

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..


May 10, 2011 | 5:16 pm

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

– Pasted Max Patch, click to expand. –

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.


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


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.)

[attachment=161939,2233]

Attachments:
  1. Screenshot20110510at21.35.33.png

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


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.


May 11, 2011 | 12:38 am

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


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.


December 21, 2012 | 12:43 pm

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


March 15, 2014 | 11:11 pm

Is it possible to do this with live.observer?


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