[chuck-users] A couple of questions

Kassen signal.automatique at gmail.com
Mon Jan 14 08:00:30 EST 2008

On 14/01/2008, Johan Nilsson <artbysnipers at hotmail.com> wrote:
 Hi, Johan!

2) Suppose I want to rout the synth from the above example through a delay,
> this would feel like a natural way to do that:
> Synth synth => Delay delay => dac;
> Is it possible to define your own chuck operator for some class? To get
> around this I have added a Gain out to the synth which can be routed like
> this:
> synth.out => delay => dac;
> It works, but it is not too beautiful

You are right. It works, it's not beautifull. What would be good would
indeed be a way to extend Ugen, for example by having a equivalent of what
"return" does for functions for in and out. Being a rather young language
ChucK has a rather long wish-list....

For now though the method you found is probably the best one, it works just
fine, I use it too.

3) I got the idea I wanted to kill a shread someting like this:
> spork~theShred() => @ Shred handle; // this is exactly like the "sporking
> shreds" chapter in the lang spec
> handle.kill(); //this is pure imagination
> 3a) My first concern is that the first line doesn't compile. The compiler
> gives "cannot resolve operator '=>' on types 'Shred' and 'Shred'… Am I
> supposed to use the @=> operator in this situation?

Yeah, the @=> operator is your friend here.
 The language specs may be wrong here or it may be a ommision in ChucK
itself. This happens and can be confusing.

If you have the time and would like to contribute you can make a account on
the WiKi and add such confusing items to the page on erata in the manual and
docs where the maintainers can find them when they do another round of
documentation updating.

3b) Is it possible to kill a shred by reference?

It is. It's also possible to ask a shred reference for the shred's id.
Personally (but I'm no language designer) it's my opinion that this could be
extended and used for inter-shred comunication as well. Right now you can
just kill them, ask them for their id or replace them, I think, kinda like
playing a absolute goverment :-).

Keep on ChucKing!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080114/33d46185/attachment.htm 

More information about the chuck-users mailing list