Frank Barknecht wrote:
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
I'm looking for a hack to find out, when a patch has finished loading. Any ideas?
[loadbang] ?
Well, maybe I should have been more verbose: I'm mostly asking this for the Pd in RjDj, but it may apply to other uses as well. We want to show a "Loading ..." icon, while a patch is still loading soundfiles etc. and remove the icon, when all is done. We only have limited control over how the patch that is loaded looks like. People may use their own "loadbang"s in their patches, so we don't know if a [loadbang] we add may fire before theirs.
hmm, not sure whether i fully understand this (and mind that i don't have a full overview of how RjDj works in my head).
first of all, you have to define, what you mean by "fully loaded". a somewhat naive definition might be: "when the source of the patch has been loaded and everything in the patch has been properly initialized". (the tricky part is of course the "properly initialized") consider a patch that loads soundfiles into an array, and does so by using: [loadbang]->[delay 5000]->[read myfile.wav myarray(->[soundfiler] now the patch will be properly initialized 5000 milliseconds after the patch has been loaded. there is no way to properly detect this.
a simpler example would involve no [delay] on the patch side (that is: everything is initialized directly via [loadbang]). now [loadbang]s are executed depth first: if you have an abstraction containing a [loadbang] and another abstraction also containing a [loadbang], the "inner" [loadbang] will always fire before the "outer" one. to make it the other way round, use [loadbang]->[delay 0] in the inner abstraction. (since timing is not crucial in your case, the above will most likely be just accurate enough)
another thing: if the patch/scene is loaded with something like [;pd open myscene.pd .( the [loadbang]s in "myscene" will fire before the sending of the open-message returns. something like:
| [t b b] | [; pd open myscene.pd .( | [print loading-done]
fmgads.r IOhannes