there's no way around class_addmethod but you can use gensym("") if you want to prevent the user from invoking the code via a message.
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
class_addmethod(classname_class, (t_method)classname_ft1, gensym("ft1"), A_FLOAT, 0);
note that you can't do that for more than one inlet, obviously.
Gesendet: Donnerstag, 08. November 2018 um 17:05 Uhr
Von: "Alexandre Torres Porres" <porres@gmail.com>
An: pd-dev <pd-dev@lists.iem.at>
Betreff: [PD-dev] simple external question (how to make an inlet acess a function)
Hi, I'm writing a signal external, it takes a signal in its main inlet and a float in its right inlet.
I want the float to be able to access a function in the code, right now I'm using something like:
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
In the "new" method, and then I also need to a class_addmethod included in the setup for "ft1" and I was hoping I didn't need that and could use another alternative.
What I think it's not elegant is that this makes the object actually take a "ft1" message in the main signal inlet. I know it's no biggie, but it annoys the hell out of me.
So is there any other way to make the inlet access a function inside the code without the need to add a method for it? Or do I just have to deal with it?
thanks
_______________________________________________ Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev