[PD] So far so failed on my part

Thomas Grill t.grill at gmx.net
Tue Aug 19 00:24:19 CEST 2003

Hi Wade,
a few very superficial remarks from my side (i'm in a hurry....).

1) I don't use straight PD code because of exactly the problems you have.
2) I use flext.
3) As far as i remember (and deducing from flext internal code) i see the
following points

> //why do I have 6 outlets defined here but 7 show up on the sphere~ object

The reason is that for a signal object the leftmost signal inlet is
implicit. It's always there.

In sphere_tilde_perform:

>  //no inclusion? what happens to w[0]?

Miller knows it.

>   t_sphere_tilde *ref = (t_sphere_tilde *)(w[1]);
>    t_sample  *in1 =    (t_sample *)(w[2]); //centerx
>     t_sample  *in2 =    (t_sample *)(w[3]); //centery
>     t_sample  *in3 =    (t_sample *)(w[4]); //centerz
>     t_sample  *in4 =    (t_sample *)(w[5]); //radius
>     t_sample  *in5 =    (t_sample *)(w[6]); //conrolx
>     t_sample  *in6 =    (t_sample *)(w[7]); //conroly
>     t_sample  *in7 =    (t_sample *)(w[8]); //conrolz
>     t_sample  *out =    (t_sample *)(w[9]); //outlet
>     int n  =           (int)(w[10]);//number of samples in block

Look good.

Apart from that you should possibly clean up the code a bit..... one running
index would probably be more clear and efficient than incrementing each
pointer individually.

> void sphere_tilde_dsp(t_sphere_tilde *ref, t_signal **sp)
>      dsp_add(sphere_tilde_perform, 10, ref,
>             sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
sp[4]->s_vec, sp[5]->s_vec, sp[6]->s_vec, sp[0]->s_n);

You announce that you are passing 10 arguments here, while you are passing
only 9!!   Hence, you should pass another sp[7]->s_vec.
Remember that you have 7 inbound and 1 outbound signals.

>  //optional question: what happens if I want to have an optional
>   //number of defaults within the object box?
>   //e.g. [sphere~ centerx centery centerz radius]

This won't work if your centerx, centery, centerz , radius are passed in as
signals. Signals can't have a default value defined inside the external.
Probably you don't need signals for these values? Will simple float messages
do it as well?

best greetings,

More information about the Pd-list mailing list