[PD-dev] Multiple instances of Pd

Hans-Christoph Steiner hans at at.or.at
Fri Jan 28 15:46:02 CET 2011


I'll repost my comment from the noisepages where this started:
http://noisepages.com/groups/pd-everywhere/forum/topic/multiple-instances-of-libpd/#post-1072

Pd was designed to be its own process, hence the current structure.  
You can easily run multiple instances of Pd if you run them in  
separate threads or processes.  Not ideal, but it works.  The pd~  
object lets you embed pd processes in other pd processes.


.hc

On Jan 28, 2011, at 7:31 AM, Marek wrote:

> Hi All
>
> What I’m trying to do is to be able to dynamically create instances of
> Pd, so I can have separate signal paths for each patch (i.e. not
> static). I'm actually working with libpd, but it's still pd under the
> hood. The reason being that I want to make an audio plugin for Logic,
> and hopefully other formats, so people can create their instruments
> and effects in Pd.
>
> At the moment, since everything is static in Pd, my audio unit works
> fine when there’s only one instance, but sounds dreadful or crashes
> when there’s another one running – this is because its running the
> same instance of Pd, but calling libpd_process_float() for both
> patches twice in one block.
>
> I’ve tried a couple of ways now to make libpd instanceable:
>
> 1. Make it into a dylib, then dynamically load it for each instance.
> This doesn’t work because when you load the lib a second time, the OS
> sees that it’s the same lib and reuses the one in memory (even if I
> copy the lib to a new location with a new name!!)
>
> 2. Hacking the Pd source. I’ve had a little bit of success with this,
> but I don’t really know what I’m doing, and was hoping there would be
> someone out there who could point me in the right direction. I’ve been
> trying to copy and clear the dsp_chain after loading each patch, and
> then swapping them back before each individual render. What I've got
> at present sometimes works for simple patches, but usually crashes
> pretty quickly.
>
> Anyone have any ideas? Am I doomed?
>
> cheers
>
> Marek
>
> --
> w:  www.mazbox.com
> t:  +44 (0) 7866 141 047
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev




----------------------------------------------------------------------------

All mankind is of one author, and is one volume; when one man dies,  
one chapter is not torn out of the book, but translated into a better  
language; and every chapter must be so translated.... -John Donne





More information about the Pd-dev mailing list