observer selected_track

Jul 9, 2011 at 2:59pm

observer selected_track

Hi

Im wondering if anyone knows a way to display the currently selected track? I realise I can do this through this_device. However, the device im using wont always be on the same track as is selected.

Im also struggling to understand how to listen for when the track is selected. Im guessing I should use loadbang?

Cheers

N

#57936
Jul 9, 2011 at 4:16pm

The seledcted_track is a property of the song.view as are selected_scene, highlighted_clip_slot, and seelcted_parameter. This code lets you observe selecting tracks on the fly. Please click the button to start this in an existing patcher.

This works within a Live Max device or a sub patcher of it. It seems it doesn’t work in a patcher started from the MFL menu: File -> New patcher.

– Pasted Max Patch, click to expand. –
#207871
Jul 9, 2011 at 6:51pm

Hey Xanadu,

thx for the snippet. It seems to display the selected track. However, it only selects for every 3rd track i click on. I can see its using deferlow, which should sort this problem out. I cant see how I can make it always display the selected track – would be grateful if you have any ideas?

Cheers

N

#207872
Jul 9, 2011 at 7:50pm

Hello!

I just tried the snippet and it seemed to work fine for me even clicking frantically…?

Here’s what I did. I went into Live and created an empty m4l patch, then opened it to edit in Max, selected all, deleted it… then I copied the above snippet, did “New From Clipboard” from the menu, then copied all of _that_ and pasted it into the empty m4l patch and saved it… then I went back to Live and selected various tracks and saw the results in Max.

What I want is to set the selected_track, which I have so far failed to do… :-( and rather need now, any hints welcome!

#207873
Jul 10, 2011 at 10:33am

This MFL device listens to changes of the selected path. The sub patcher also has a menu control to select a track yourself. It had to be a subpatcher else it would only be visible when the path it is on is selected. This device does not work for return tracks and the master track.

#207874
Jul 10, 2011 at 11:45am

This is a little update on the device.

#207875
Jul 10, 2011 at 12:35pm

This third version works for the return_tracks and the master_track too.

#207876
Jul 10, 2011 at 4:58pm

Came back to clear up my previous post!

Of course, within Max it’s pretty easy to set the selected track by calling M4L.api.SetSelectedTrackIndex (although looking at how hard it is to do by directly using live.object and live.path is pretty daunting)… my issue is that I can’t do this in Javascript! I think I need to post this on the JS forum though.

Xanadu: thanks for these great examples! If you’re going to post code in the longer term, I strongly suggest you get a free github account and put the examples there – the advantage is that you can link to the source code and fix errors there instead of having to come back to the thread and update it again, but also that people can read and share your code.

I did this: http://ax.to/max

#207877
Jul 11, 2011 at 5:08pm

Hello tom,

For javascript you can use the LiveAPI object, which is documented at http://www.cycling74.com/docs/max5/vignettes/js/jsliveapi.html . As it references the same interface in Live I suppose you can perform the same tasks as with live.xx objects in MFL.

I’ve published some devices om MaxForLive.com, but I consider these code snippets just as proof-of-concept and didn’t bother to make it an official publucation.

Cheers,

Willem.

#207878

You must be logged in to reply to this topic.