Rather than having a feature request, i thought its better to try it myself and ask how-to:
Is there a way to add handler (invoke function on event) when dsp is added. I want to have vst effects be minimized/collapsed by default.
This is no real code and i don’t know lua yet but its better than to explain it in English witch I am bad at:
if dsp_effect.type == 'VST' than
dsp_effect.minimized = True
Im making things up here. Maybe this could be approached in a different way.
You would probably want such a tool to “follow your actions” and not look for devices being added in each and every track?
So, you would start by attaching a notifier here:
Whenever the track changes, add the following inside the above notifier method
This will allow you to handle device events from the current track only.
In general, notifiers and observables are simple to work with, but require a lot of “boilerplate code” to set up.
For example, you need to remove old notifier methods before adding new ones, check when a new song is created etc.
Imagine that you tool had some initialization code which set these listeners, then you could do something like this:
-- reference to the track we are receiving events from...
-- remove and add nofier in one go...
if not obs:has_notifier(fn) then
-- do something clever
-- possible actions: "insert", "remove", "swap"
if (curr_track) then
curr_track = renoise.song().selected_track
More info about the observer pattern
Thanks - this is great answer
Now that i have learned a little about lua + renoise api,
I will definitely try to implement that…
stay tuned for more questions