hello,
i fighting with observables a little.
I create an instrument and then a sample.
I connect notifiers /I could handle it/ but how do I disconnect it all when I close the tool ?
Checking for tool.visible in tool.app_idle_observable ?
if tool is not visible then remove notifiers ?
You can create a āglobalā table (or even better some class, if you wanna go that route) where you store used observables and their functions. Then itās easy to just iterate and unobserve whatever has been added without keeping track of stuff manually.
itās still not a little clear to me how the tool actually behaves.
the first start is clear, but after the subsequent āendā so the tool window is not visible, it seems to me that the tool is just moved to the background but still running.
After the subsequent call from the menu, the start-up procedure is the same as the first time or different. it seems to me that its global variables still contain values when hidden.
Ah. That one can be used if you just want to make a :bang() to run several functions at once. Maybe not quite the same.
But if you find yourself using a lot of observables/functions that you know you want to easily destroy at once (at gui close), itās not a bad idea to just store them in a global table. tbl[1] = { obs = theobservable, func = regged_function }. Then itās easy to destroy them all at once with a table iteration. (PS. donāt forget removing the destroyed element from this table)
In larger projects, I like being able to keep track of used observables anyway, with some simple rprint ādebuggingā.