[chuck-users] changing a value with a function

Martin Ahnelöv operagasten at gmail.com
Sat Nov 3 15:48:43 EDT 2007


lör 2007-11-03 klockan 20:37 +0100 skrev Atte André Jensen:
> Martin Ahnelöv wrote:
> 
> > Sure it works! I do it all the time!
> 
> Ok, I meant to say that the commented-out line "spork ~ 
> changer2(f.freq)" doesn't work. At least it throws an error here...
> 
> > If FilterBasic doesn't work, try the more inflexible BPF, instead (But
> > if it doesn't work, it's a bug). 
> 
> FilterBasic works great as shown in changer(), but I'd like to write a 
> function like changer2() that can takes as parameter a pointer to an 
> Ugens parameter (like "f.freq") and modifies that.
> 
> Or are we speaking of different things?
> 

I don't realy understand what the problem is, but is this the solution
you are looking for?


function void changer2(FilterBasic f, float min, float max){
     while(true){
         Std.rand2f(min,max) => f.freq;
         400::ms => now;
     }
}

spork ~ changer2(f, 200., 1000.);


Hope that helps,
Gasten



More information about the chuck-users mailing list