<div dir="ltr">Hey guys, first time posting here; short-time reader :)<br><br>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 <b>'g.' </b><br>
<br>The input is time 'x' in number of seconds. <br><br>//==============================================//<br>function void fadeOut(int x)<br>{<br> 1 => float master; x * 1000 => int top; <br> for( 0 => int i ; i < top; i++ )<br>
{<br> if (master > 0) master - (master / (top * .2 )) => master => <b>g</b>.gain; <br> 1::ms => now; <br> }<br>}<br>
//==============================================//<br clear="all"><br>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...<br>
<br>//==============================================//<br>function void fadeIn(int x, <b>string y</b>)<br>{<br> .01 => float master; x * 1000 => int top; <br> for( 0 => int i ; i < top; i++ )<br> {<br>
if (master < 1) master + (master / (top * .2)) => master => <b>y</b>.gain; <br> 1::ms => now; <br> }<br>}<br>//==============================================//<br><br><br>Am I crazy for thinking something like this would be useful? <br>
<br>If anyone could offer some insight, even to a possible workaround, I'm all ears!<br><br>Cheers,<br>Dimitri. <br><br>-- <br>Duc, sequere, aut de via decede.<br>
</div>