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
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. 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
On 11/8/18 5:25 PM, Christof Ressi wrote:
there's no way around class_addmethod
indeed, that's the way Pd works (or use proxy objects. shudder)
but you can use gensym("") if you want to prevent the user from invoking the code via a message. note that you can't do that for more than one inlet, obviously.
actually it's pretty easy (although probably unusual) to invoke such a method:
[symbol( | [$1 foo bar baz( |
gfmdsar IOhannes
OK, if you want to be sure, you can use something like gensym("\a") instead. if you want to be really sure, use the mongolian vowel seperator or the MD5 hash of your Pd executable.
Gesendet: Donnerstag, 08. November 2018 um 17:41 Uhr Von: "IOhannes m zmölnig" zmoelnig@iem.at An: pd-dev@lists.iem.at Betreff: Re: [PD-dev] simple external question (how to make an inlet acess a function)
On 11/8/18 5:25 PM, Christof Ressi wrote:
there's no way around class_addmethod
indeed, that's the way Pd works (or use proxy objects. shudder)
but you can use gensym("") if you want to prevent the user from invoking the code via a message. note that you can't do that for more than one inlet, obviously.
actually it's pretty easy (although probably unusual) to invoke such a method:
[symbol( | [$1 foo bar baz( |
gfmdsar IOhannes
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
Em qui, 8 de nov de 2018 às 15:07, Christof Ressi christof.ressi@gmx.at escreveu:
OK, if you want to be sure, you can use something like gensym("\a") instead. if you want to be really sure, use the mongolian vowel seperator or the MD5 hash of your Pd executable.
Right, I get the hack, thanks for the suggestion, seems like gensym("\f") is safe enough, I wouldn't really know how to do it, although seems Pd now deals with "", but I really didn't get how so.
Anyway, seems like the only true way of working around this limitation is with "proxy", and, yeah, not worth it :)
cheers
Gesendet: Donnerstag, 08. November 2018 um 17:41 Uhr Von: "IOhannes m zmölnig" zmoelnig@iem.at An: pd-dev@lists.iem.at Betreff: Re: [PD-dev] simple external question (how to make an inlet
acess a function)
On 11/8/18 5:25 PM, Christof Ressi wrote:
there's no way around class_addmethod
indeed, that's the way Pd works (or use proxy objects. shudder)
but you can use gensym("") if you want to prevent the user from
invoking the code via a message.
note that you can't do that for more than one inlet, obviously.
actually it's pretty easy (although probably unusual) to invoke such a method:
[symbol( | [$1 foo bar baz( |
gfmdsar IOhannes
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
Em qui, 8 de nov de 2018 às 14:25, Christof Ressi christof.ressi@gmx.at escreveu:
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.
how is that so? Cause this is what I was using already...
"new" method:
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
"setup":
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
oh, you mean like an empty symbol, right? I think I get it... I'll try something like that
Em qui, 8 de nov de 2018 às 15:07, Alexandre Torres Porres porres@gmail.com escreveu:
Em qui, 8 de nov de 2018 às 14:25, Christof Ressi christof.ressi@gmx.at escreveu:
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.
how is that so? Cause this is what I was using already...
"new" method:
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
"setup":
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