[PD] libpd separating gui from core

Dan Wilcox danomatika at gmail.com
Sun Feb 23 22:40:54 CET 2014


On Feb 23, 2014, at 3:29 PM, Jonathan Wilkes <jancsika at yahoo.com> wrote:

> On 02/23/2014 07:37 AM, Dan Wilcox wrote:
>> On Feb 23, 2014, at 2:11 AM, Jonathan Wilkes <jancsika at yahoo.com> wrote:
>> 
>>> Do you have an example of a patch that suffers from Pd's current single-threaded implementation that would be measurably improved by using a multi-threaded approach?
>> Ask any of the people who have to run two instances of Pd in order to have both GEM and audio without dropouts. And this is in 2014 with modern computers orders of magnitude more capable than when Pd was first designed.
> 
> This is probably naive, but wouldn't it suffice to have an object that does automatically what the user is forced to do manually atm?

I'm not saying there should be some mechanism to separate this object from that ... only that the gui should be on it's own thread, audio in the audio callback thread, and something like GEM running opengl in it's own thread. This is how modern applications work and also how using libpd inside OpenFrameworks works, same for iOS.

> Manual -- user opens a Pd instance for GEM and a separate Pd instance for audio
> Auto -- user creates an object [foo-audio-magic somepatch.pd] which automatically fires up a separate instance-- _not_ a child of the first-- for the audio.

Or it *just works*, like Jitter in Max. Whether we split hairs about *how* it should work, the fact remains that to most people I introduce to Pd to, Max is more attractive as things like audio & video *just work* together. If the stakeholders of Pd are truly the users of Pd, then the complaints and requests for solving these kinds of issues should be obvious from the last 5-7 years ...

>>> Also, what is the metric to use here?
>> Mmm open a larger patch with audio running, momentary dropouts.
> 
> How do you know that's due to Pd's single-threadedness, and not some CPU-hogging object, or a poorly optimized object chain, or Pd doing GUI calculations in the core thread as well as tk's thread?

It can happen when opening patches in libpd, including those without "CPU-hogging objects". This is obviously *without* the gui.

>> Also, this is perhaps better to ask a beginner trying to pickup PD after starting with Max MSP, they may not give you "meaningful metrics" but their impression may be along the lines of "not only does this program look old, but it keeps clicking when I'm dragging things around". Etc etc
> 
> That particular problem is due directly to *_getrect calls in a patch with lots of objects (and possibly a bunch of *_click calls if hovering over an object that does a lot of computation in such a function).  It's not super easy to solve, but it's approachable because the Pd-GUI already exists.  But that's a completely separate issue from getting something like GEM to run in its own thread.

Yeah, stuff like that we should be able to solve. I'm not for ditching the Tcl/Tk gui at all. The work you and Ivica have been doing seems to be going a long way to fix this. Great! I just really hope this goes back into vanilla somehow or can be split up into between libpd and a gui implementation, etc. Otherwise, I fear a return to DD.

>> Things maybe acceptable to us PD "grey beards", but at some point it would be nice to find a way to enter the modern, multicore multithreaded world. Moores law has shifted from clock speed to "just add more cores" years ago now, so it's not like "buy a faster machine" is going to magically solve single threaded speed issues.
> 
> It's not acceptable, but if you want to move forward _and_ do work that will be in sync with or accepted into Pd vanilla I don't see a way forward.  I can't even get help docs into Pd vanilla, and they were written to the PDDP spec that this community came up with and approved.  And as you know, there's a publicly viewable list of the same exact frustrations from all kinds of developers with various styles of communication.

This is what I'm worried about and if that's truly the case, why bother really?

>> At the very least, we should be able to run a performance intensive GEM patch with real time audio without drop outs *while* editing.
> 
> Did you use any of the Pd-l2ork versions before it moved to Tkpath? It didn't solve the *_getrect problem I mentioned above, but it solved a whole lot of the problems that cause dropouts while editing, mainly by shooting way fewer messages across the socket.

True, but will that be integrated back into vanilla? It's the same problem again ...

--------
Dan Wilcox
@danomatika
danomatika.com
robotcowboy.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20140223/c0f7babc/attachment.htm>


More information about the Pd-list mailing list