[PD] Dynamic patching with audio - review

Mathieu Bouchard matju at artengine.ca
Sun Mar 20 22:30:53 CET 2011


On Sun, 20 Mar 2011, Rich E wrote:

> Dynamic patch loading/unloading (not dynamic patching) could also be 
> done directly in a pd external, provided the following small patch is 
> accepted (: 
> http://sourceforge.net/tracker/?func=detail&aid=3189135&group_id=55736&atid=478072

In the meanwhile, a simple workaround is to access the canvas_list global 
variable and walk the linked list of canvases to figure out what has been 
added. Sounds like a hack but is much faster than instantiating an object 
from the linked-list of at least two hundred or thousand names in 
pd_objectmaker.

Besides, loading a patch with glob_evalfile is not the only way to load a 
patch. You can also load it through pd_objectmaker by pretending that it 
is an abstraction. Then you pick up the pointer using pd_newest(). In that 
case, however, don't bother looking in canvas_list, it's not there.

Once you have a canvas pointer, you can find the $0 easily. It involves 
using a private interface that you can have by copying a struct definition 
from pd's source code in the same manner that several externals already 
use. Right after that, ce_dollarzero is yours.

> Lastly, the $0 value that libpd recovers lets you send signals or 
> messages to a unique patch, without the need of [namecanvas] - a method 
> that causes a bag full of problems in itself when it comes to dynamic 
> patch loading/unloading.

I'm not sure I understand. What are the problems with [namecanvas] ?

  _______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC


More information about the Pd-list mailing list