hi there,
Im doing an external in C and i wonder if there is a method or a way to send messages from the external(inside of the object) that is received by an receive object
sorry for the english, and thanks
Send messages from the ex
hi there,
Im doing an external in C and i wonder if there is a method or a way to send messages from the external(inside of the object) that is received by an receive object
sorry for the english, and thanks
Cmon... anyone??
how does it work the send and receive objects??
maybe have a look at x_connective.c in the pd source code. that may help.
/* -------------------- send ------------------------------ */
static t_class *send_class;
typedef struct _send
{
t_object x_obj;
t_symbol *x_sym;
} t_send;
static void send_bang(t_send *x)
{
if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing);
}
static void send_float(t_send *x, t_float f)
{
if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f);
}
static void send_symbol(t_send *x, t_symbol *s)
{
if (x->x_sym->s_thing) pd_symbol(x->x_sym->s_thing, s);
}
static void send_pointer(t_send *x, t_gpointer *gp)
{
if (x->x_sym->s_thing) pd_pointer(x->x_sym->s_thing, gp);
}
static void send_list(t_send *x, t_symbol *s, int argc, t_atom *argv)
{
if (x->x_sym->s_thing) pd_list(x->x_sym->s_thing, s, argc, argv);
}
static void send_anything(t_send *x, t_symbol *s, int argc, t_atom *argv)
{
if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, s, argc, argv);
}
static void *send_new(t_symbol *s)
{
t_send *x = (t_send *)pd_new(send_class);
if (!*s->s_name)
symbolinlet_new(&x->x_obj, &x->x_sym);
x->x_sym = s;
return (x);
}
static void send_setup(void)
{
send_class = class_new(gensym("send"), (t_newmethod)send_new, 0,
sizeof(t_send), 0, A_DEFSYM, 0);
class_addcreator((t_newmethod)send_new, gensym("s"), A_DEFSYM, 0);
class_addbang(send_class, send_bang);
class_addfloat(send_class, send_float);
class_addsymbol(send_class, send_symbol);
class_addpointer(send_class, send_pointer);
class_addlist(send_class, send_list);
class_addanything(send_class, send_anything);
}
/* -------------------- receive ------------------------------ */
static t_class *receive_class;
typedef struct _receive
{
t_object x_obj;
t_symbol *x_sym;
} t_receive;
static void receive_bang(t_receive *x)
{
outlet_bang(x->x_obj.ob_outlet);
}
static void receive_float(t_receive *x, t_float f)
{
outlet_float(x->x_obj.ob_outlet, f);
}
static void receive_symbol(t_receive *x, t_symbol *s)
{
outlet_symbol(x->x_obj.ob_outlet, s);
}
static void receive_pointer(t_receive *x, t_gpointer *gp)
{
outlet_pointer(x->x_obj.ob_outlet, gp);
}
static void receive_list(t_receive *x, t_symbol *s, int argc, t_atom *argv)
{
outlet_list(x->x_obj.ob_outlet, s, argc, argv);
}
static void receive_anything(t_receive *x, t_symbol *s, int argc, t_atom *argv)
{
outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
}
static void *receive_new(t_symbol *s)
{
t_receive *x = (t_receive *)pd_new(receive_class);
x->x_sym = s;
pd_bind(&x->x_obj.ob_pd, s);
outlet_new(&x->x_obj, 0);
return (x);
}
static void receive_free(t_receive *x)
{
pd_unbind(&x->x_obj.ob_pd, x->x_sym);
}
static void receive_setup(void)
{
receive_class = class_new(gensym("receive"), (t_newmethod)receive_new,
(t_method)receive_free, sizeof(t_receive), CLASS_NOINLET, A_DEFSYM, 0);
class_addcreator((t_newmethod)receive_new, gensym("r"), A_DEFSYM, 0);
class_addbang(receive_class, receive_bang);
class_addfloat(receive_class, (t_method)receive_float);
class_addsymbol(receive_class, receive_symbol);
class_addpointer(receive_class, receive_pointer);
class_addlist(receive_class, receive_list);
class_addanything(receive_class, receive_anything);
}
This is what i looking for, I appreciate. Can i find the code of all objects in pd's source code??
yeah they're in the src folder
Oops! Looks like something went wrong!