On 8/30/05, Nathaniel Virgo <nathaniel.virgo@xxxxxxxxxxxx> wrote:
I'm working on a live performance in SuperCollider and at the moment all
the code is in one file, which is starting to get a little unweildy, so
I was wondering if anyone has any thoughts or experience they would like
to share about how to effectively manage SuperCollider projects in
multiple files.
Let me put in a plug for chucklib. It may not suit Nate's needs at the
moment, but for future reference here's how you would do it with that
lib (based on the idea of synthdef + routine):
// define the base prototype
AdhocClass({
~event = (eventKey: \dummy); // I'm probably going to change this syntax
~preparePlay = { |self|
~synthdef.send(s); // see below for population of ~synthdef
};
~asPattern = { |self|
Proutine({
loop {
~routineAction.value(self);
~delta.notNil.if({
(play:0, delta: ~delta).yield;
}, { nil.yield });
};
});
};
}) => PR(\sdrout);
// repeat this bit with each distinct combination of synthdef and action
PR(\sdrout).chuck(BP(\proc1), nil, (
synthdef: SynthDef(...), // these parameters get plugged into
routineAction: { |self| // the prototype instance at creation time
// whatever you would have in your routine,
// put it here
~delta = /* time to next */;
};
));
BP(\proc1).play; // go
BP(\proc1).stop; // stop
BP(\proc1).free; // release resources
Don't have time to go into much detail now, but there are other insert
points for your own code (~prep for initialization, ~stopCleanup to
release resources needed only when playing, ~freeCleanup to release
other resources). There are also some GUI and MIDI hooks that are
pretty cool, and safeguards against some bad things that can happen in
performance (accidentally starting a process twice, etc.).
I'll fill in the gaps later if people are interested. This is all
based on thinking I started in spring 2004 about organizing long
performances, which led me to a solution of dynamically loadable
prototypes (PR) and instances (BP). The code is still in flux and not
thoroughly documented yet, but so far it's working very well for me.
hjh