[PD] Help with writing externals

zmoelnig at iem.at zmoelnig at iem.at
Sun Apr 4 09:49:52 CEST 2004


Zitiere thewade <pdman at aproximation.org>:

> 
> /*-----------fftbin\'s perform function-------------------*/
> t_int *fftbin_tilde_perform(t_int *w)
> {
>   t_fftbin  *ref = (t_fftbin *)(w[1]);         //data structure
>   t_sample  *in1 = (t_sample *)(w[2]);         //fft~ output
>   int        in2 = (int)(w[3]);                //bin number
>   t_sample  *out = (t_float *)(w[4]);          //outlet
>   int        n   = (int)(w[5]);                //number of samples in
> }
> /*------------------------fftbin dsp function------------*/
> void fftbin_tilde_dsp(t_fftbin *ref, t_signal **sp)
> {
>   dsp_add(fftbin_tilde_perform, 5, ref,
>           sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
> }
> /*-------------------------------------------------------*/

i just noticed that there is a discrepancy between passed arguments (dsp_add)
and how you interpret them in the perform()-routine:
while you are passing the sp[1]-s_vec as the "3rd" argument to the perform
routine, it is somehow interpreted as "int n2".

are you sure that you are getting 2 input-signal vectors ? (you have to acquire
2 signal-inputs in the _new()-function).

note: it is required (from you!) that you keep signal-in/out's consistent over
the _new(), _dsp() and _perform() routines (at least you have to understand what
is going on ;-))


mfg.a.srd
IOhannes




More information about the Pd-list mailing list