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
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.
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
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!
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.
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
Hello tom,
For javascript you can use the LiveAPI object, which is documented at https://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.