Listen for track or device rename in M4L.Chooser.maxpat
Hello everyone!
This is my first forum post, I only started using Max a month ago :)
I'm building a Max for Live device that makes use of the Browse.DeviceParameters.maxpat LiveAPI chooser. Something I really liked about this chooser is its ability to "listen" to track/device additions or deletions from the user. The umenu(s) are repopulated with the correct items residing in the Live session (track or devices). What's most important is that the update to the umenus doesn't affect your current selection in the umenu tree.
Unfortunately, if a track or device is renamed, the umenu(s) would not be updated appropriately. You could circumvent this by adding and deleting a new track, thereby forcing a "refresh" for the umenu(s).
After 3 days of experimenting I believe I have come up with a solution. The reason I'm posting here is to receive feedback on my fix. I would like to know whether I have committed any unforgivable Max sins or if I'm on the right track with learning Max.
I had to alter the following files:
Browse.DeviceParameters.maxpat
M4L.chooser.maxpat
M4L.chooser.js
Things to look out for compared to the originals:
"p Rename Logic" patcher in M4L.chooser.maxpat
new function "rename(id)" in M4L.chooser.js
I have attached these files here with the word "Feedback" appended in case you want to try it out but not mess up your default files :)
Have a nice day everyone,
Panos
i would like to check your solution but my laptop is dead.
i too, was annoyed by m4l.chooser's inability to update itself when a track was renamed, as well as it's lack of a sub-routing chooser.
that's why i made my own chooser: https://cycling74.com/forums/e%C2%B7z%C2%B7chooser-a-simple-midi-track-output-routing-and-sub-routing-m4l-device%C2%B7-feel-free-to-use-please-help-to-update-or-improve!
which version of live are you using?
since 9.7 some commands such as "current_output_routing" have been "deprecated", which means that perhaps they may not work in live 10, or if they do, perhaps they will not work in future updates. the deprecated commands have been replaced by others that require the use of the dict object. i have not updated my patch to use the new commands.
it may be that using these new commands will solve some problems of the old commands, such as the renaming issue. but no one has given me an answer to this yet.
these topics may also be of interest to you:
it would be nice to get some feedback if you discover anything new.
i will check your patches when i have a new laptop and access to maxforlive again
the hyperlink to the post with my track_chooser is not working, you can find it by searching for "e.z.chooser" in the forum search
Hi Mark, apologies for the late reply I haven't checked the forums in some time. It turns out that my fix was only sort of a half fix. Meaning that the renaming component worked but only for the track and the device that was selected in the dropdown menus.
E.g If I picked "Left Guitar" track and a "Distortion" device on its chain, the my fix would pickup if these two elements were renamed. However if I renamed any other track or device, this would not be immediately be reflected in the dropdown menus.
What makes me tick is the fact that when you add or delete a track, there is some sort of refresh that runs inside of M4L.chooser.js. If I could pinpoint what that function is + be able to get some sort of rename event message from LOM (Live Object Model), I could combine the two and voila.
Although i feel more comfortable with Max since I started 3 months ago, some deeper stuff like writing in javascript feels a bit a outside my depth.
As soon as I'm done submitting my dissertation, I will try out your chooser and let you know !
I'm currently using Live 9.7.1.
Thanks,
Panos
i still haven't got my new laptop so i also haven't checked your patch yet.
my patch is refreshing everything whatever track is renamed, or re-ordered, however there are two problems:
1. it is getting stuck if you click the "edit" button while there are routings setup with it.
2. it is using the deprecated track routing commands.
as for number 2, i have got a reply in this thread: https://cycling74.com/forums/how-to-set-the-new-output_routing_type-with-javascript
that the deprecated commands are still working in Live 10, and that replacing them with the new commands (using the [dict] object), may solve the renaming problem.
if this is true then my patch can be simplified (by scrapping the rename/re-order bug-fix part of the patch) and perhaps that will also solve problem number 1.
i still have other priorities though, so it may be a while before i revisit this patch to update with the new commands, so if you beat me to it, let me know :)
on the links i pasted in my previous post, Broc and Tyler Mazaika have provided the solutions on how to replace with the new commands using [dict], i just haven't had the time yet to implement them in my patch.
ps: you can use the "email alerts on" button to be notified by email if there has been a reply to any thread you wish to follow.
I'm definitely gonna use the email alerts didn't notice until you said so.
This is good news though, I will definitely inspect your solution + the deprecated commands replacement by Broc and Mazaika and see what i come up with. I'll reply back to this post if I manage to break new ground :)
Thanks,
Panos