Your help has bee very, well, helpful but alas my moron nature is dominating. I need further help writing my first external. The questions are in the comments. (http://www.tessabeth.org/code/)
Many thanks again to Thomas Grill!
-wade
Hi Wade, a few very superficial remarks from my side (i'm in a hurry....).
following points
//why do I have 6 outlets defined here but 7 show up on the sphere~ object
box?
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, Thomas
hi Thomas,
Thomas Grill wrote: ...
signals. Signals can't have a default value defined inside the external.
why not? I guess calling pd_float((t_pd *)x, default_value) for the first inlet does the job, just like
in = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)in, another_default_value);
does for the rest of them?
Krzysztof
Oh, i think i know:
//no inclusion? what happens to w[0]?
w[0] is the address of the dsp function. Therefore, the internal PD signal processing loop looks (omitting type-casts) like
while(w = w(w) );
That's it. It's great. It's a bit like the GUT isn't it?
Thomas
----- Original Message ----- From: "PD Trouble" pdman@aproximation.org To: "the great ones" pd-list@iem.kug.ac.at Sent: Monday, August 18, 2003 11:23 PM Subject: [PD] So far so failed on my part
Your help has bee very, well, helpful but alas my moron nature is
dominating. I need further help writing my first external. The questions are in the comments. (http://www.tessabeth.org/code/)
Many thanks again to Thomas Grill!
-wade
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list