Creating Track and Clip menu in Max for Live?
Hi all,
In my Max for Live plugin, I'm trying to have a menu object that displays every midi track as a dropdown, and then after selection have another menu object that displays all the clips from that track for future processing on that clip. I'm currently doing this using Javascript/the LOM and the umenu object to repeatedly get and populate the umenu.
However, this approach has some downsides, mostly in that there a lot of edge cases that get complicated very fast (such as, needing to use a live.observer to refresh the menu everytime a clip or track is say renamed or created).
Since the logic is for me getting quite complicated, I wanted to check before I make it robust that there's not an easier way of creating a dropdown to select tracks and clips, if anyone knows of one.
If you're not aware there are Snippets that do this kind of stuff, which could at least save you from writing some of your own code.
Right click > Paste From > Max for Live > Live API Browsers > Browse.Tracks.maxpat
But your assessment is quite right about the downsides. Especially because having code like that in many devices at once creates a lot of background work for Live any time the tracklist/names are modified, since a bunch of places will respond to perform identical work.
I think ideally there would be a way to only populate the not-currently-selected entries when the menu is actually being opened. This has me thinking and I may toy around with a hacky UI to do this.