[chuck-users] String as an argument...

Dimitri eliftherious at gmail.com
Wed Oct 8 04:52:07 EDT 2008


Hey guys, first time posting here; short-time reader :)

I've run into a bit of trouble programming a function to fade a ugen in or
out. The code below will work nicely on g.gain however I can't abstract it
to affect anything else without controlling the reference object, in this
case *'g.' *

The input is time 'x' in number of seconds.

//==============================================//
function void fadeOut(int x)
{
    1 => float master;  x * 1000 => int top;
    for( 0 => int i ; i <  top;  i++ )
        {
            if (master > 0) master - (master / (top * .2 ))  => master => *g
*.gain;
            1::ms => now;
        }
}
//==============================================//

Obviously the below would be my desired function, but even delving through
ChucK's string class, it doesn't seem that there's a function to return an
object reference from a string...

//==============================================//
function void fadeIn(int x, *string y*)
{
    .01 => float master;  x * 1000 => int top;
    for( 0 => int i ; i <  top;  i++ )
        {
            if (master < 1) master + (master / (top * .2)) => master
=> *y*.gain;

            1::ms => now;
        }
}
//==============================================//


Am I crazy for thinking something like this would be useful?

If anyone could offer some insight, even to a possible workaround, I'm all
ears!

Cheers,
Dimitri.

-- 
Duc, sequere, aut de via decede.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20081008/746f489a/attachment.htm>


More information about the chuck-users mailing list