[sc-users] how to use initClass with synthdefs?
Dan Stowell
danstowell at gmail.com
Fri Dec 1 07:53:14 PST 2006
Hi -
The thing to bear in mind is that the initClass methods run when the
lang is (re)compiled - i.e. typically when the server is not yet
booted. So "send(s)" will do nothing, it will send to a basically
nonexistent server. The only way is to use a disk-writing method like
.writeDefFile or .writeOnce.
You've said you don't want to save the SynthDef - why? If you're
really sure you don't, then there's no point using initClass at all.
You should instead do something like:
* define an instance variable in the class like synthdefssent=false
* when the class is called to do its stuff, if(synthdefssent.not, {
send the synthdefs; synthdefssent=true})
(that works assuming an instance of the class only deals with one
server, which is very often true)
Dan
2006/11/30, chris <chris at oedo.net>:
> hullo you helpful lot :)
>
> can anyone point me in the direction to go regarding *initClass and
> synthdefs?
>
> I've tried this
>
> Bob {
> *initClass {
> var s = Server.default;
>
> SynthDef(\etc,{ ........ }).send(s);
>
> }
> }
>
> and it doesn't seem to work (i get FAILURE /s_new SynthDef not found). i
> don't really want to load these synthdefs and save them, i'd rather this
> class compiled them when it needed them.
>
> any clues? i'm sure there's something obvious i'm missing, what is it? :)
>
> thanks!
> C
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
--
http://www.mcld.co.uk
More information about the sc-users
mailing list