[chuck-dev] ugen design question

Bradford Garton garton at columbia.edu
Sat Aug 19 08:29:14 EDT 2006


Hey cHuCksters --

I've written a ugen to deliver values coming from inlets on the max/msp 
[chuck~] object into the chuck executing environment.  The essential part 
of the function looks like this:

     CK_DLL_CTRL( maxinlet_ctrl_inletval )
     {
        t_CKINT inletno = GET_CK_INT(ARGS);

        // inletvals[] is set from max/msp
        RETURN->v_float = inletvals[inletno-1];
     }

and is set up thus:

     func = make_new_mfun( "float", "inletval", maxinlet_ctrl_inletval );
     func->add_arg( "int", "value" );

To get this to update during execution, I can use a script like this:

     maxinlet maxin;
     sineosc a;

     while (true) {
         // gets the value coming from inlet #1
         1 => maxin.inletval => a.freq;
         10::ms => now;
     }

However, ideally I'd like the function to deliver/update the incoming 
value whenever it came from max/msp, something like this:

     maxin.inletval => a.freq;
     3.5::second => now;

(i.e. no loop in the script, but during execution any change coming from 
maxin.inletval would indeed affect the sineosc frequency).

I suspect that I could set it up to tick somehow at the audio rate, but 
that seems overkill.  Is there a way to do this in chuck?

brad
http:://music.columbia.edu/~brad


More information about the chuck-dev mailing list