[PD] loadbang behavior

Antoine Villeret antoine.villeret at gmail.com
Mon Jan 2 17:57:11 CET 2017


This explains the "wrong argument for loadbang method" but not why the
method is called twice at patcher loading.

--
do it yourself
http://antoine.villeret.free.fr

2017-01-02 17:52 GMT+01:00 Miller Puckette <msp at ucsd.edu>:

> Oh, I see :)
>
> the "loadbang" method is now called with a floating-point argument, so you
> can do this:
>
> static void loadbang_loadbang(t_loadbang *x, t_floatarg action)
> {
>     if (action == LB_LOAD)
>         outlet_bang(x->x_obj.ob_outlet);
> }
>
> and just get the one bang.  This was done to allow "init" and "Close" bangs
> as well.
>
> cheers
> Miller
>
> On Mon, Jan 02, 2017 at 05:34:02PM +0100, Antoine Villeret wrote:
> > here is a sample code that demonstrate the issue :
> > https://raw.githubusercontent.com/avilleret/helloworld/
> loadbang_issue/helloworld.c
> >
> > When the object is created, loadbang method is called.
> > Save the patch.
> > Close it
> > Reopen it, then the loadbang method is called twice (maybe one time at
> > object loading and one more at patcher loadbang).
> >
> >
> >
> > --
> > do it yourself
> > http://antoine.villeret.free.fr
> >
> > 2017-01-02 17:25 GMT+01:00 Miller Puckette <msp at ucsd.edu>:
> >
> > > Happy new year to you...
> > >
> > > I don't get this behavior - can you send a sample patch?
> > >
> > > thanks
> > > Miller
> > >
> > > On Mon, Jan 02, 2017 at 04:50:47PM +0100, Antoine Villeret wrote:
> > > > Hello,
> > > >
> > > > Happy new year pd-list !
> > > >
> > > > With pd-0.46-7, loadbang method was called only once when patcher
> loads.
> > > > Now with 0.47-1, loadbang method are now called twice.
> > > > Why loadbang method is called twice ?
> > > >
> > > > As far as I understand, loadbang method could be called not only on
> > > patcher
> > > > load (LB_LOAD), but also when closing an abstraction (LB_CLOSE) and
> > > before
> > > > the object is connected to parent patcher (LB_INIT).
> > > >
> > > > Many externals uses this loadbang method to initiate their state.
> > > > This new behavior trig a lots of "wrong argument for loadbang method"
> > > error
> > > > in pd console.
> > > >
> > > > Is it a good practice to rely on loadbang call to initiate objects ?
> or
> > > > should we avoid it and use [loadbang] object and/or make
> initialisation
> > > in
> > > > object_new method ?
> > > > --
> > > > do it yourself
> > > > http://antoine.villeret.free.fr
> > >
> > > > _______________________________________________
> > > > Pd-list at lists.iem.at mailing list
> > > > UNSUBSCRIBE and account-management -> https://lists.puredata.info/
> > > listinfo/pd-list
> > >
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20170102/ffdf917f/attachment.html>


More information about the Pd-list mailing list