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

Adam T. Lindsay atl at comp.lancs.ac.uk
Wed Sep 25 19:30:32 CEST 2002

Thanks, Thomas.

I was trying to avoid unnecessary copies, but I really should try the
"simple" way first. Thanks for your suggestions.


Thomas Grill said this at Wed, 25 Sep 2002 16:45:47 +0200:

>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
>PD-dev mailing list
>PD-dev at iem.kug.ac.at

 Adam T. Lindsay                      atl at comp.lancs.ac.uk
 Computing Dept, Lancaster University   +44(0)1524/594.537
 Lancaster, LA1 4YR, UK             Fax:+44(0)1524/593.608

More information about the Pd-dev mailing list