I can't remember how to pass multiple arguments to an external. I need to pass any number of float arguments. I think it goes something like void external_tilde_new(float *f_args, float num_args)
I've been searching thru the cvs repo to see if I can find an example, but I haven't found one yet. Any suggestions?
Chuck
Hallo, Charles Henry hat gesagt: // Charles Henry wrote:
I can't remember how to pass multiple arguments to an external. I need to pass any number of float arguments. I think it goes something like void external_tilde_new(float *f_args, float num_args)
I've been searching thru the cvs repo to see if I can find an example, but I haven't found one yet. Any suggestions?
One suggestion first: These kinds of question (basically everything with C-code in it) are much more on-topic on the pd-dev list, and not so much on this list here.
To answer your question: You may want to search differently. Just try to think of one of the objects which accept more than one argument. [route] or [pack] or [dac~] come to my mind. route's code is in Pd in x_connective.c
E.g. route is created with:
static void *route_new(t_symbol *s, int argc, t_atom *argv) ...
Frank Barknecht _ ______footils.org_ __goto10.org__
okay, Thanks, Frank I'll route these questions to the right list, from now on (except this message). and I think I uderstand how this will work now.... in this example: static void *route_new(t_symbol *s, int argc, t_atom *argv)
int argc is the count of the number of arguments, and t_atom *argv must be the vector of arguments themselves. (this I'm inferring from seeing it in code) I still don't get what t_symbol *s is for, yet. Thanks, Chuck
On 12/3/06, Frank Barknecht fbar@footils.org wrote:
Hallo, Charles Henry hat gesagt: // Charles Henry wrote:
I can't remember how to pass multiple arguments to an external. I need to pass any number of float arguments. I think it goes something like void external_tilde_new(float *f_args, float num_args)
I've been searching thru the cvs repo to see if I can find an example, but I haven't found one yet. Any suggestions?
One suggestion first: These kinds of question (basically everything with C-code in it) are much more on-topic on the pd-dev list, and not so much on this list here.
To answer your question: You may want to search differently. Just try to think of one of the objects which accept more than one argument. [route] or [pack] or [dac~] come to my mind. route's code is in Pd in x_connective.c
E.g. route is created with:
static void *route_new(t_symbol *s, int argc, t_atom *argv) ...
Ciao
Frank Barknecht _ ______footils.org_ __goto10.org__
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, Charles Henry hat gesagt: // Charles Henry wrote:
okay, Thanks, Frank I'll route these questions to the right list, from now on (except this message). and I think I uderstand how this will work now.... in this example: static void *route_new(t_symbol *s, int argc, t_atom *argv)
int argc is the count of the number of arguments, and t_atom *argv must be the vector of arguments themselves. (this I'm inferring from seeing it in code) I still don't get what t_symbol *s is for, yet.
I think, s holds the name of the object, "route" in this case. IIR it's required if you construct an object with "A_GIMME"-arguments.
This is taken from IOhannes Externals-Howto:
The arguments of the constructor-method depend on the object-arguments defined with class_new.
+----------------------------------------------------------+
| class_new-argument | constructor-argument
|
|--------------------+-------------------------------------|
| A_DEFFLOAT | t_floatarg f
|
|--------------------+-------------------------------------|
| A_DEFSYMBOL | t_symbol *s
|
|--------------------+-------------------------------------|
| A_GIMME | t_symbol *s, int argc, t_atom *argv
|
+----------------------------------------------------------+
Frank Barknecht _ ______footils.org_ __goto10.org__
On Sun, 3 Dec 2006, Charles Henry wrote:
int argc is the count of the number of arguments, and t_atom *argv must be the vector of arguments themselves. (this I'm inferring from seeing it in code) I still don't get what t_symbol *s is for, yet. Thanks,
The s stands for selector, it's the name of the method. In the case of object construction, the selector is the name of the class you're trying to instantiate, else it's whatever the leading symbol of the message is (e.g. "list" or "symbol" or "set" or "open" or...)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Sun, 3 Dec 2006, Charles Henry wrote:
I can't remember how to pass multiple arguments to an external. I need to pass any number of float arguments. I think it goes something like void external_tilde_new(float *f_args, float num_args) I've been searching thru the cvs repo to see if I can find an example, but I haven't found one yet. Any suggestions?
you need to instruct class_new or class_addcreator what your argument list is going to look like. If you have one float arg, end it like "A_FLOAT,0)" but if you have two, then end it like "A_FLOAT,A_FLOAT,0)". However, if you have a large number or variable number of them, do it like "A_GIMME,0)" and use a method signature like:
t_pd *blah_new(t_symbol classname, int argc, t_atom *argv)
but then you have to check the type of each atom and extract its content (convert a float atom to a float, or a symbol atom to a symbol).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada