On 08/11/2012 01:58 PM, Michael Zacherl wrote:
In Pd-extended it could be easier since there are more possibilities to
control the init-phase of a just loaded patch.
I think it's in iemlib (Iohannes could chime in) but admittedly I forgot about it, since also there was a lot of discussion wether this should go into Vanilla or not,
the secrect is [initbang], which fires when the abstraction is ready
(rather
than [loadbang], which fires when all the patch (with all the
abstractions,
sub-patches and what not) is ready)).
unfortunately, i haven't found a way to make [initbang] without hacking Pd itself, so it's not part of any library (e.g. iemlib).
instead, there is a (low-level) "patch" for Pd somewhere in the tracker,
which
is applied to Pd-extended (but unfortunately not to Pd-vanilla).
thus: if you want to need [initbang] (which you do if you really need
variable
in/outlets in abstractions), you need to either compile Pd yourself or use
Pd-
extended (only the core binary, no need for any externals here)
fgmasdr IOhannes
Also, if you need a pre-loadbang event which happens right before loadbang but after all the objects have loaded, you could try pd-l2ork which has also pre-loadbang event. Currently it is only being used for universal presets that depend on the graph placement of all objects to keep track of them. Therefore, the only time for the presets to detect objects they are tied to correctly is only after they have all been created but before loadbang (as one could loadbang a new preset which would not work unless all the objects have been paired properly). The reason preset_hub and preset_node do this is because this way a single preset can deal with multiple instances of a same abstraction and still be able to distinguish which one is being referenced. See pd-l2ork K12 mode for examples of how this works (tl;dr: one abstraction hosts presets and keeps track of all other abstractions and their states)...
HTH
Ico