Now, I am running into the issue that this synth node is
created a second time whenever I (have to) re-evaluate that code as part
of a bigger initialization block.
I wonder if there is an even better way to achieve the permanent node
but avoiding the double-creation?
You have to be careful if you call such a block multiple times if you redefine ~init and then add it again you will end up with multiple copies of the function. You need to define ~init outside the block, or check to see if it exists before defining like ~init = ~init ? {your function}
you’ll also want to store your synth somewhere and check if it exists before recreating the synth like:
~synth.isNil.if {~synth = Synth(\default) }
beyond that you might want to register your synth Synth(\default).register so that you can check if its running with ~synth.isRunning so that you can recreate it if it has been stopped.
For persistent nodes another way is to write a Class so that stuff is added to the ServerTree during class tree initialization - you can check out one of the Quarks that does this like SafetyLimiter for example.
Which Quark is the SafetyLimiter in? I couldn’t find it by browsing the
list of Quarks in the IDE and it seems there is no search function for
classes provided by Quarks(?).