[PD] Timing and PD....
IOhannes m zmoelnig
zmoelnig at iem.at
Thu Oct 30 10:01:40 CET 2008
B. Bogart wrote:
> Hey all,
> I'm having more and more problems with sync in PD. By sync I mean that
> parts of my patches have processing delays that mess up timing. In
> general I've been using buffers and delays to keep things working.
do you mean you are using buffers and delays to distribute the workload
over time, in order to not get cpu peaks?
> This approach is not very scalable.
> I find myself using the "timer" object all the time to see if there is a
> processing delay I have to worry about. That is in cases where there is
> a bang saying an operation is done.
> Two examples I'm working on now (in Gem):
> First there is a delay between sending a message and the pix_buffer to
> store, and then again for pix_buffer_read to read the pixels. The delay
> is long enough that trigger does not work, there needs to be a delay to
> make sure the image in the buffer is the right one. (sometimes as much
> as 200ms)
i am not sure i understand you here.
it seems like you are having problem to synchronize 2 threads (e.g. the
main Pd thread an an image-loading thread).
if everything is done in a single thread, then no timing problems should
occur, as everything will happen in 0 logical time (though it might
block the main thread considerably long so that the patch will "stutter").
if multiple threads are involved (e.g. to avoid the stuttering), then
you might experience problems where you try to access images before they
are actually loaded.
when using [pix_buffer] to load images with the [open $1( message, then
afair, everything will be in a single thread. thus, no timing problems
using [pix_image] to load images will default to using threads (if
available), at least on linux. you can turn this off by sending a
[thread 0( message to [pix_image].
it would be interesting to see examples that expose your problem.
> A second example is that I'm using pix_share and and second PD instance
> to offload some CPU usage. Making sure the image sent to that PD
> instance and the image received later in the chain is difficult.
the solution is timestamps.
(which i think [pix_share] doesn't have right now...)
> I'm not writing for specific advice, hence the generalities, but wanted
> to start a discussion on the issue.
sorry to give specific answers.
More information about the Pd-list