-
shakfu
Thanks Seb! Very much appreciate the detailed explanation.
I managed to get it working with your advice.
Here's a demonstrative case:
#include "m_pd.h" static t_class *demo_class; typedef struct _demo { t_object x_obj; t_glist *mycanvas; } t_demo; void demo_bang(t_demo *x) { t_atom av[4]; SETFLOAT(av + 0, (t_float)300); SETFLOAT(av + 1, (t_float)10); SETSYMBOL(av + 2, gensym("r")); SETSYMBOL(av + 3, gensym("test")); pd_typedmess((t_pd *)x->mycanvas, gensym("obj"), 4, av); } void *demo_new(void) { t_demo *x = (t_demo *)pd_new(demo_class); x->mycanvas = canvas_getcurrent(); return (void *)x; } void demo_setup(void) { demo_class = class_new(gensym("demo"), (t_newmethod)demo_new, 0, sizeof(t_demo), CLASS_DEFAULT, 0); class_addbang(demo_class, demo_bang); }
-
shakfu
Thanks for your reply, Seb,
Despite your advice, I'm still not sure what the correct way to go about it. The following segfaults.
t_glist *mycanvas = canvas_getcurrent(); t_atom av[4]; SETFLOAT(av+0, (t_float)300); SETFLOAT(av+1, (t_float)10); SETSYMBOL(av+2, gensym("r")); SETSYMBOL(av+3, gensym("test")); pd_typedmess((t_pd *)mycanvas->gl_owner, gensym("obj"), 4, av);
Any further tips would be much appreciated.
-
shakfu
It's pretty straightforward to send messages to objects in a c external using functions like pd_typedmess (e.g pd_typedmess((t_pd *)gensym("pd")->s_thing, gensym("dsp"), 1, argv) ).
But is there a canonical way to send object creation messages to the parent canvas: for example (msg 300 10 bang)?
-
shakfu
@bocanegra Great stuff. Love the rapid iteration. Version 2 vanilla is much better! Thanks for sharing your sweet drum abstractions.
-
shakfu
@bocanegra I converted your addperc abstraction / demo to vanilla puredata (attached). It was worth the effort because it sounds amazing
-
shakfu
@bocanegra no worries. Thanks for the explanation. Looks pretty straightforward to fix then.
-
shakfu
@bocanegra, addperc works nicely (and sounds great) in Pd-l2ork but not in vanilla. In the latter I get the following errors:
0-sqt: no such object 0-range: no such object 0-vcof: no such object 0-vcor: no such object 0-vcoa: no such object 0-mixg: no such object 0-mixr: no such object 0-mixa: no such object 0-shape: no such object 0-bpf: no such object 0-bpq: no such object 0-hpf: no such object 0-lpf: no such object 0-ega: no such object 0-egr: no such object