[PD] amdf~

IOhannes m zmoelnig zmoelnig at iem.at
Mon Jul 4 17:47:19 CEST 2005


Ed Kelly wrote:


> t_int *amdf_tilde_perform(t_int *w, t_amdf_tilde *x) {

this MUST read:
t_int *amdf_tilde_perform(t_int *w) {


>   t_amdf_tilde  *x = (t_amdf_tilde *) (w[1]);
>   t_sample  *input = (t_sample *)     (w[2]);
>   t_sample *errpr1 = (t_sample *)     (w[3]);
>   t_sample *errprx = (t_sample *)     (w[4]);
>   int            n = (int)            (w[5]);
>   x->x_pitch       = 0;
> //  float         sr = float sys_getsr(void); //how to get sample rate in external?
this reads:
float         sr = sys_getsr();
(but should be done in the dsp_add() function, like x->x_sr=sys_getsr();)


>   }
>   return (w+6); 
>   outlet_float(&x->x_outlet, x->x_pitch);
> }

here you return from the funtion before you outlet anything: you never 
reach the outlet_float code.
btw, it should read:
  outlet_float(x->x_outlet, x->x_pitch);

> 
> void amdf_tilde_dsp(t_amdf_tilde *x, t_signal **sp) 
> {
>   dsp_add(amdf_tilde_perform, 5, x, sp[0]->s_vec, sp[3]->s_vec, sp[2]->s_vec, sp[0]->s_n);
> }

you don't have sp[3], that is why your code is crashing.


i suggest reading a bit about C-programming (kernighan/ritchie is a good 
start); and of course the Externals-writing-HOWTO (as proposed by Georg)




mfg,asdr,.
IOhannes




More information about the Pd-list mailing list