[PD] Modifying "dsp chain" live !!!
Miller Puckette
mpuckett at man104-1.ucsd.edu
Fri Nov 16 20:06:01 CET 2001
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