emulating UGen connections in own classes
Hi We can do: SndBuf s => dac; Is it possible to write my own class, MySndBuf and make the following possible, and if so, how?: MySndBuf s => dac; I know I've asked this before (and it wasn't possible, IIRC), so basically I'm wondering if things have changed with the latest release? -- Atte http://atte.dk http://modlys.dk
2009/2/7 Atte André Jensen
We can do:
SndBuf s => dac;
Is it possible to write my own class, MySndBuf and make the following possible, and if so, how?:
MySndBuf s => dac;
I know I've asked this before (and it wasn't possible, IIRC), so basically I'm wondering if things have changed with the latest release?
I'm pretty sure it's still not possible, so you'll have to write your own code to forward the samples to the dac by hand. -- Tom Lieber http://AllTom.com/
Tom Lieber wrote:
I'm pretty sure it's still not possible, so you'll have to write your own code to forward the samples to the dac by hand.
No problem. It would just be more elegant if the general chuck syntax could be extended with user generated classes... -- Atte http://atte.dk http://modlys.dk
Hi Atta,
A bunch of us use "GenU" style chuck classes for this. I think it
started with Frostburn on the board. Basically, you make a class that
looks like this:
public class GenU
{
Gain output;
Gain input;
fun UGen chuck () {
return output;
}
fun UGen chuck (UGen ugen) {
ugen => input;
return output;
}
}
Then you use it like this
GenU None;
None.chuck() => dac;
You can even do (note the lack of parens)
Step step => None.chuck => dac;
Now, just have your classes inherit from GenU, and connect them like this.
This is a sorta hacky workaround; there isn't, as far as I know, a way
to do just None => dac.
Cheers,
Rogan
On Sat, Feb 7, 2009 at 1:40 PM, Atte André Jensen
Tom Lieber wrote:
I'm pretty sure it's still not possible, so you'll have to write your own code to forward the samples to the dac by hand.
No problem. It would just be more elegant if the general chuck syntax could be extended with user generated classes...
-- Atte
http://atte.dk http://modlys.dk _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
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
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
2009/2/7 Rogan Carr
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() ).
Can't you with parentheses? (FooBar thingy).chuck() => dac; -- Tom Lieber http://AllTom.com/
participants (3)
-
Atte André Jensen
-
Rogan Carr
-
Tom Lieber