[PD] passing multiple arugments to new_ routine

Mathieu Bouchard matju at artengine.ca
Mon Dec 4 06:15:43 CET 2006


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


More information about the Pd-list mailing list