[chuck-users] constructing UGens by composition

Ge Wang gewang at CS.Princeton.EDU
Tue Oct 3 01:04:06 EDT 2006

Hi Graham!

> Now, if we wish to make a special version of a UGen by inheritance
> alone, we can already do this. By extending the UGen class you wish
> to use, you should be able to add or overwrite methods or variables.
> But what about composition? What if we wish to chain together several
> already useful into some compound effects object (for brevity's sake,
> perhaps)?

You are definitely right.  We've actually been planning something for 
this very purpose.  In short, one should be able to define a UGen and 
use it as you would any other (e.g. in terms of =>), but you can't yet 
in the current version.

> So, to get the behavior we are going for in the language, it seems like
> the most direct way would be to specify an in and out reference for the
> correct UGens like so:
> public class StdFx extends UGen {
>   //preconstructor
>   PoleZero pz => NRev nrev => pan2 p;
>   pz @=> this.in;
>   p @=> this.out;
>   //other stuff
>   ...
> }
> So, will this kind of behavior be possible within the language as
> currently designed? I don't know.

This is certainly a (good) possibility.  We are still toying with 
different ways to do this cleanly.

> So, what's the plan for supporting this?

No specific date yet.  It's been planned from since the beginning, but 
not much has been done yet.  Perhaps this is a good time to iron it 
out, especially if there is demand.  One potential roadblock is the 
unfinished garbage collector - this may add features to classes (like a 
finalize() method and others) and could affect how we deal with UGen's 
on connect and disconnect.

Thank you for your thoughtful analysis of this feature.  I fully agree 
with you.  We'll priority boost this.

Best wishes,

More information about the chuck-users mailing list