[PD] writing externs that call methods of objects through outlets

Mike Wozniewski mike at ozmediasolutions.com
Wed May 25 18:55:58 CEST 2005


Hi,

I'm writing an external and I would like instances of my external to 
directly call methods in objects attached to it's outlets. Strange, yes, 
but I would like to see if it's possible.

I have a piece of code I found in a post that traverses the outlets 
using obj_nexttraverseoutlet and returns t_object pointers. This is very 
cool, but how do I call methods given the t_objects? In fact, what is a 
t_object?

Heres's the code. For now it just prints the class type of the connected 
objects.

void myfunction(t_myobj *x) {
    post("these are the types of objects we feed:");
    t_object *src, *dest;
    src = &(x->x_obj);
    t_outconnect *oc;
    t_outlet *op;
    t_inlet *ip;
    int outno = obj_noutlets(src);
    int inno;
    while (outno--) {
        oc = obj_starttraverseoutlet(src, &op, outno);
        while (oc) {
            oc = obj_nexttraverseoutlet(oc, &dest, &ip, &inno);
            post("\t-> [%s]", class_getname(*(t_pd *)dest));
        }
    }
}

Any help is greatly appreciated.

Thanks,
Mike Wozniewski




More information about the Pd-list mailing list