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

Yves Degoyon ydegoyon at free.fr
Fri Nov 16 01:42:16 CET 2001


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 ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20011116/d4cfeb63/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spigot~.tar.gz
Type: application/x-gzip
Size: 4353 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20011116/d4cfeb63/attachment.bin>


More information about the Pd-list mailing list