I sometimes forget to do ~panner3y.free; before creating a new instance with different parameters. So there are then two instances of this Synth running, and when I do .free I release only one of them and the other is … inaccessible and can only be freed with Ctrl+period (Ctrl+C+X in Emacs). Since I have number of busses and different control synths on them, Ctrl+period frees too much of my infrastructure and takes away time to re-run everything.
Is there any other way how to access/free such a synth node? I have plotTree gui open all the time, so I could use the ID for example, but I cannot find a way to send it some method on the server to free it?
On top of what James said, you can construct a (client-side) Node object back from ID with basicNew, although I think there are some limitations when doing that in the sense that you don’t get all features of the object you’ve “lost”. But surely release and free work on the basicNew-ed node object.
// say we know just the id
i = Synth(\default).nodeID
y = Node.basicNew(s, i)
y.release(1.5) // or .free for abruptly
It’s sometimes useful to do that with events (save the id in a callback, or even construct the node there), in which case one needs be aware than an event can create multiple synths on chords etc. More discussion on the latter: Stopping an event with infinite duration.
Yes, it would probably be wise to put synths in specially designated groups for that and then release the group, but if I work in default group, then this solution would not work, since I would release everything in the default group.
Thank you for your solutions, I used them both, s.sendMsg can be really fast, but the second solution came handy to ‘reclaim’ it. Something like
~mySynth = Synth(\default); // nodeID:1000
~mySynth = Synth(\default); //second instance with the same name/reference., nodeID:1001
~mySynth.free; // frees 1001
~mySynth.free; // does not free the first instance with nodeID 1000
~mySynth = Node.basicNew(s, 1000)
~mySynth.set(\freq, 800); // can change parameters now
~mySynth.free; // frees the synth with nodeID 1000!
PS: there is no checkbox to mark certain answer as solution?
I’m guessing it’s only available for the main question category. I noticed it also doesn’t exist for “Development”.
I found it even more useful for when you want to “hear back” from the server when the node is done, as using the node interface’s onFree then saves you from setting up your own OSC receiver explicitly.