Hallo, Phil Stone hat gesagt: // Phil Stone wrote:
I'm trying to figure out how to use [singleton] from [sssad] so that I can instantiate some lookup tables once and only once for use in multiple patches.
The [singleton] help patch is a bit cryptic, but I've so far guessed that I can wrap the table-creating object like so:
[singleton WTAB waveTables]
That's correct. Sorry about the cryptic help file, I'll make a better one.
It appears that the tables are correctly allocated by this, but they are not initialized; i.e. the arrays are created, but the code that fills them in is not triggered, even though there is a [loadbang] in [waveTables] that's supposed to trigger it.
So my question is first, am I even close to using [singleton] correctly? and secondly, do objects created by [singleton] get a loadbang?
They don't get a loadbang, because they are dynamically created. Dynamically created abstractions don't execute their loadbangs!
It's possible to trigger the loadbang manually with a message to the subpatch, the objects are created in. For singleton.pd this subpatch's receiver is is pd-$0-container. Attached is a version of singleton which automatically sends a loadbang message to it. After I get over my jetlag, I'll consider making this the default in sssad's version of singleton.pd as well. Also it may be useful to send the value of $0 to an outlet, maybe the first one, but that may break patches which rely on only a 0 or a 1 coming out there, so I guess I'll have to introduce a second outlet.
Frank Barknecht _ ______footils.org_ __goto10.org__