Fw: [PD-dev] float & symbol in second inlet
Thomas Grill
t.grill at gmx.net
Thu Aug 29 22:06:39 CEST 2002
Hi Mathieu,
It's only a sketch, actually fragments from flext code.
good luck,
Thomas
----------------------------------------
As stated before, you need proxy objects which (actually their method)
receive the messages for the non-left inlets.
This is a proxy object, just like a normal one
> static t_class *px_class;
>
> struct px_object
> {
> t_object obj;
> int index; // this holds the inlet index
> };
This is the class setup which defines the proxy class
> px_class = class_new(gensym("flext_base
proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
>
> // bind a method (except any message) to the class
> class_addanything(px_class,px_method); // for other inlets
px_method looks like that... it's for anything messages.
> void px_method(px_object *obj,t_symbol *s,int argc,t_atom *argv)
> {
> // in obj->index there's the number of the inlet!
> }
In the object setup function you construct the proxies for all non-left
inlets (or for whatever inlet you like)
> for(ix = 0; ix < inlets; ++ix) {
> // all inlets except the leftmost
> inlets[ix] = (px_object *)pd_new(px_class);
> inlets[ix]->index = ix;
> inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0,0); // 0,0 to accept
all types of messages
> }
More information about the Pd-dev
mailing list