[chuck-users] emulating UGen connections in own classes

Rogan Carr rogan.carr at gmail.com
Sat Feb 7 18:32:48 EST 2009


Hi Atta,

You unfortunately cannot do

FooBar thingy.chuck() => dac;

The declaration has to be on its own line (otherwise it looks like
you're sending the FooBar object to thingy.chuck() ).

I used to do something like

thingy.connect(dac)

but I found that it's a lot easier to string objects along in a chain
if you have an overloaded chuck function.  For example, I have an
Allpass filter class that I use a lot when I'm designing reverbs, and
I do

Allpass A
input => A.chuck => Delay d => ...
A.chuck() => Delay d2 => ...

The only irritating thing is remembering to write the parentheses when
you don't chuck anything at connect.

Hope that helps!
Rogan

On Sat, Feb 7, 2009 at 5:24 PM, Atte André Jensen <atte.jensen at gmail.com> wrote:
> Rogan Carr wrote:
>
>> public class GenU
>> {
>>
>>    Gain output;
>>    Gain input;
>>
>>    fun UGen chuck () {
>>        return output;
>>    }
>>
>>    fun UGen chuck (UGen ugen) {
>>        ugen => input;
>>        return output;
>>    }
>>
>> }
>
> Thanks for the idea, will try it out for sure!
>
>> Then you use it like this
>>
>> GenU None;
>>
>> None.chuck() => dac;
>
> How about:
>
> GenU None.chuck() => dac;
>
>> Step step => None.chuck => dac;
>>
>> Now, just have your classes inherit from GenU, and connect them like this.
>
> So you mean I could write my own class FooBar, that inherits from (the
> already defined in my scope) GenU and do:
>
> FooBar thingy.chuck() => dac;
>
> I have to decide if the slight difference in syntax (added ".chuck()") will
> be more confusing than what I normally do, which is having a member function
> "connect()", used like this:
>
> FooBar thingy;
> thingy.connect(dac);
>
> --
> Atte
>
> http://atte.dk    http://modlys.dk
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>


More information about the chuck-users mailing list