Hi all -
The easiest way to do this is the way the timer object does it (see timer_new() in x_time.c) - the line that creates the inlet is:
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("bang"), gensym("bang2"));
... then when teh inlet get a bang, it calls timer's "bang2" method. (The timer object itself responds to that inlet by generatng output, contrary to all other Pd objects - but the method isn't obliged to do that, and probably in general it shouldn't.)
cheers Miller
On Wed, Jul 02, 2014 at 07:43:45PM -0700, Jonathan Wilkes via Pd-list wrote:
Hi Rob, If you look at the code for floatinlet_new and friends, you'll see they all create an inlet and then associate it with the addy of member variable. If there were a banginlet_new, it could certainly create the inlet on behalf of your object, but what would it store? Bang doesn't have a value associated with it. To be philosophical about it, the only thing a banginlet could store is that is stores nothing. :)
However, if what you are after is a subsidiary inlet (one with a nonzero index) that has a bang method, you have to use what is called a proxy inlet. See the code for [list append] or [list prepend] in x_list.c. I think both have a secondary (or "proxy") object that receives messages associated with the right inlet of the respective list object. Once you set it up you just add whatever method you want to your proxy class and everything should work.
It would be nice if there were a convenience function that made this easier. (Or maybe there is and I'm missing it.)
-Jonathan
On Wednesday, July 2, 2014 6:58 PM, Robert Esler via Pd-list pd-list@lists.iem.at wrote:
Hello everyone, My intention is to have an external with an active inlet that accepts a bang and at least one passive inlet that also accepts a bang. The active inlet works fine. However, I don't see an equivalent function call for passive bang inlets similar to creating a passive float inlet, e.g floatinlet_new(t_object *owner, t_float *fp); I have tried using symbolinlet_new(…)but cannot seem to get it to recognize a bang without an error, inlet: expected 'symbol' but got 'bang'. I have also tried the inlet_new(…) but do not get the desired results. I'm stuck. If anyone has any suggestions I'd love to hear them. Thanks for the time. Rob Esler _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list