Thanks everyone.
The inlet_new(…) method of dispatching a bang to a bang2 t_symbol works
great. I had to change the class_addmethod a little from the x_time.c example.
Not sure why on my build I have to add a t_atomtype (instead of just
terminating with a 0) as an argument but this is what I did and it works:
class_addmethod(mynamo_class, (t_method)mynamo_generate, gensym("bang2"),
A_NULL, 0);
Not sure if the A_NULL is allocating memory somewhere, or passing a dummy
value to my function but I don't see any errors or leaks. If I see anything
I'll report back.
I also really like the dummy class method used in the [list] family. I'll
try that too at some point.
Much appreciated,
Rob
On Jul 2, 2014, at 11:56 PM, Miller Puckette <[email protected]> wrote:
> 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
>> <[email protected]> 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
>>
>> _______________________________________________
>> [email protected] mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
>> _______________________________________________
>> [email protected] mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list