[PD-dev] signal external and IOhannes's tutorial

Thomas Grill t.grill at gmx.net
Wed Sep 25 16:45:47 CEST 2002

Hi Adam,
i think one shouldn't rely on the input and output pointers to be the same.
I would rather suggest that you test whether they are different, in this
case copy the input to the output and then do your in-place operation on the
output vectors.
In my externals i tend to use algorithms that adapt to an in-place (in and
out are equal) or out-of-place (in and out are different) situation.


> But more importantly, how do I pass these pointers to enforce an in-place
> computation on the part of the signal processing network? Should I do
> something that looks "wrong," like:
> void inPlace_dsp(t_inPlace *x, t_signal **sp)
> {
> dsp_add(inPlace_perform, 4, x,
> sp[0]->s_vec, sp[0]->s_vec, sp[0]->s_n); // in and out are the same
> }
> t_int *inPlace_perform(t_int *w)
> {
> t_inPlace *x = (t_inPlace *)(w[1]);
> t_sample  *in =    (t_sample *)(w[2]);
> t_sample  *out =    (t_sample *)(w[2]);
> int          n =           (int)(w[3]);
> /*
> etc...
> */
> return (w+6);
> }
> Thanks for the help,
> adam

More information about the Pd-dev mailing list