SynthDescLib uses a ServerBoot function to send all .add
-ed SynthDefs at boot time. (This is why it’s OK to add SynthDefs before booting the server.)
During class library initialization (*initClass
), SystemSynthDefs adds many SynthDefs into the default SynthDescLib, and relies on the server boot function to transmit those to the server. If that function is removed, then the SynthDefs don’t make it over.
This is an opinion (others might disagree), but – IMO – correct functioning of SC depends upon server nodes/buffers/SynthDefs etc being in sync with the language-side objects that control them. Rebooting a server destroys the server-side structures, while leaving language-side objects in place. Those objects are then invalid, and then it gets a lot harder to make sure things will keep working.
s.boot;
b = Buffer.alloc(s, 1024, 1, { |buf| buf.sine1Msg([1], asWavetable: false) });
b.plot; // OK
s.reboot;
b.plot;
^^ ERROR: Message '-' not understood.
RECEIVER: nil
Of course “nobody would expect b
to be intact, so why would one do this” (but server/language coordination is a major point of confusion).
For that reason, at least for my own usage patterns – if I need to reboot a server, I might as well recompile the class library and start completely over from scratch. Speaking only for myself, I don’t see much benefit in rebooting only half the system. I do use reboot
when I’m testing something specific that doesn’t involve language-side object cruft. I don’t use it in general (and I designed my workflow to automate the loading of complex objects, to reduce the temptation to preserve them).
I don’t think anyone thought it through far enough to discourage it “officially.”
The problem is that there is no way to distinguish your functions from classlib functions. It should be safe to remove yours, but not the ones that other classes depend on.
One solution would be to annotate the functions. If you have the JITLibExtensions quark, you could press Halo into service for this.
(
~addSystemBoot = { |func, annotation(\mine)|
ServerBoot.addHalo(func, annotation);
ServerBoot.add(func);
};
~removeSystemBoot = { |annotation|
var halo = ServerBoot.getHalo;
halo.keysDo { |func|
if(halo[func] == annotation) {
ServerBoot.remove(func);
halo.removeAt(func);
}
};
};
)
ServerBoot.objects // 'all' has 3
~addSystemBoot.({ "\n\ncustom boot function\n".postln; }, \mine);
ServerBoot.objects // 'all' has 4
~removeSystemBoot.(\mine);
ServerBoot.objects // 'all' has 3
Currently the class library doesn’t have a built-in way to annotate objects.
hjh