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