[PD] Modifying "dsp chain" live !!!

Yves Degoyon ydegoyon at free.fr
Sat Nov 17 01:01:51 CET 2001


you're right for changing variables,
it's cleaner to use namespace's variables,
but this patch also enables to change the function
itself dynamically
and, in an extern, eventually to change
the dsp function.

cheers.

yves/


----- Original Message -----
From: "Miller Puckette" <mpuckett at man104-1.ucsd.edu>
To: "Yves Degoyon" <ydegoyon at free.fr>
Cc: <pd-list at iem.kug.ac.at>
Sent: Friday, November 16, 2001 8:06 PM
Subject: Re: [PD] Modifying "dsp chain" live !!!


> HI all,
>
> I'm unclear why you'd want to do this... if it's to change parameters to
> DSP objects, that's better done by storing them as state variables;
example,
> lop~ cutoff frequency change.
>
> cheers
> Miller
>
> On Fri, Nov 16, 2001 at 01:42:16AM +0100, Yves Degoyon wrote:
> > hi list, hi miller,
> >
> > I've made a little patch to enable externs
> > to modify the dsp chain while the dsp processing
> > is running... this avoids to restart dsp processing
> > when a parameter is changed, this is illustrated
> > by the "spigot~" extern attached.
> >
> > Without this patch, I had to restart dsp processing
> > and all other dsp objects got interrupted.
> > That was really annoying !!!
> >
> > What was made basically was adding the following code :
> >
> > d_ugen.c :
> >
> > ################################################
> >     /* function to dynamically change dsp functions parameters
> >        arguments are :
> >        f : pointer to your dsp function
> >        rank : rank of the argument to change
> >        value : new value of this parameter
> >
> >        QUITE DANGEROUS !!! no checking is possible
> >        because the number of arguments is not stored in dsp_chain
> >        Copyleft ydegoyon at free.fr */
> > void dsp_mod(t_perfroutine f, int rank, int value )
> > {
> >     va_list ap;
> >     t_int *pdsp_chain = dsp_chain;
> >     t_int i;
> >
> >     while ( pdsp_chain ){
> >        if ( *pdsp_chain == (t_int)f ){
> >           *(pdsp_chain+rank) = value;
> >           post ( "dsp_mod : warning : modifying dsp chain, better know
what you're doing!!!!" );
> >           break;
> >        }
> >        pdsp_chain++;
> >     }
> > }
> > ################################################
> >
> > This function has to be exported in m_pd.h :
> >
> > ################################################
> > EXTERN void dsp_mod(t_perfroutine f, int rank, int value);
> > ################################################
> >
> > An example of use is available in spigot~.c attached.
> >
> > This is really dangerous to use this,
> > because it enables an extern to transform
> > dsp_chain into a mess,
> > so use it with care !!!
> >
> > Cheers,
> >
> > Yves Degoyon.
> >
> > PS : it seems to be patch day, so I don't deliver this as a patch
> > for incremental reasons ( I've applied some patches myself ).
>
>
>




More information about the Pd-list mailing list