[chuck-users] changing a value with a function

Martin Ahnelöv operagasten at gmail.com
Sat Nov 3 15:57:48 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?
> 

Ah, wait! Don't care about my last message. I didn't read carefully
enough.

I don't believe it's possible to do the thing that you are looking for
that way. You best shot is o create a getValue()-function that do all
the calculation, and then create value2freq(), value2q(), value2gain etc
(that calls getValue()) when you need them.

Something that could make this easier is a way to insert arbitrary code
into spork-statement:

spork ~ { /*mycode*/ };

but that's probably not here in the next few releases.

Gasten



More information about the chuck-users mailing list