Hallo,
I'm looking for a hack to find out, when a patch has finished loading. Any ideas?
Frank Barknecht Do You RjDj.me? _ ______footils.org__
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.
Frank
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
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
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)
You did understand my problem very well! :)
The approach from above is what I'm currently playing with and for "well-behaved" patches that don't use [delay]s after loadbangs themselves, it works pretty okay.
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]
Hm, that's a very interesting approach, maybe this can work in RjDj, depending on I how switching "scenes" is realized internally (which I don't know).
Frank
On Mon, 25 May 2009 12:50:20 +0200 IOhannes m zmoelnig zmoelnig@iem.at wrote:
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.
Agreed, patch-loaded and patch-ready are different things.
In some of my patches, I take a systematic approach to startup instead of having loadbangs dotted here and there. A subpatch called [pd init] is often there, containing a single loadbang and a big [ t b b b b b ... ], connected from right to left order to a set of [s startx], [start y] ... objects. The last thing on that list would be "ready". I'v found that useful to precisely sequence the startup of patches with initially unstable filters etc.
This doesn't help the cases of existing patches though, unless we want to retrofit them all.
And it doen't help with Iohannes case where a [delay] is placed after the [loadbang].
a.
Andy Farnell wrote:
Agreed, patch-loaded and patch-ready are different things.
In some of my patches, I take a systematic approach to startup instead of having loadbangs dotted here and there. A subpatch called [pd init] is often there, containing a single loadbang and a big [ t b b b b b ... ], connected from right to left order to a set of [s startx], [start y] ... objects. The last thing on that list would be "ready". I'v found that useful to precisely sequence the startup of patches with initially unstable filters etc.
i think this is good practice.
This doesn't help the cases of existing patches though, unless we want to retrofit them all.
And it doen't help with Iohannes case where a [delay] is placed after the [loadbang].
i guess the main problem with RjDj is that any number of people can create scenes. the less restrictions imposed on them (e.g. "you have to send a bang to the global 'ready' receiver once your patch is properly initialized") the better (though of course this would simplify everything very much). ideally no restrictions are imposed at all, and everything works automagically.
fgamsdr IOhannes
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
i guess the main problem with RjDj is that any number of people can
create scenes. the less restrictions imposed on them (e.g. "you have to
send a bang to the global 'ready' receiver once your patch is properly
initialized") the better (though of course this would simplify
everything very much). ideally no restrictions are imposed at all, and everything works
automagically.
My current idea is to abuse the [soundoutput] abstraction that replaces [dac~] in RjDj scenes to report when loading ends. We can assume, that all scenes use it, so a
[loadbang]--->[delay]--->[s RJDJ_PATCH_IS_LOADED]
inside soundoutput.pd will catch most cases.
Frank
'Reading "pd" files is done simply by passing the contents to the pd message interpreter.' So the last thing in the file is the last thing loaded. Is there any statement the interpreter would ignore (or better: post a soft error that could be taken as "done")?
If you can be certain a
On Mon, 25 May 2009 12:29:31 +0200 Frank Barknecht fbar@footils.org 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.
Ciao
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list