[PD] dynamic subpatch creation

Phil Stone pkstone at ucdavis.edu
Thu Sep 3 01:01:21 CEST 2009


Hello all,

I'm playing with dynamic object creation, and so far have figured out 
how to dynamically instantiate objects inside a subpatch and connect 
them up.  Now I'm trying to dynamically create subpatches inside of that 
subpatch, and I thought I could do this by sending "canvas...."/ 
"restore..." messages to the subpatch in the appropriate order.  When I 
try this, I crash Pd.  Now, it may be that I'm not forming the messages 
correctly, but before I wander down that potentially-primrose path of 
debugging, I'm wondering if what I'm doing is possible at all.

This is the message I'm trying to send when Pd crashes ($1 contains the 
subpatch's name -- I know this is correct from earlier experiments that 
didn't use canvas/restore):

;
$1 canvas 5 5 362 348 f_instance 0;
$1 obj 29 86 routeOSC /name;
$1 obj 29 111 routeOSC /f /q;
$1 obj 22 160 bp~;
$1 obj 22 195 *~ 0.0002;
$1 obj 22 224 env~ 8192;
$1 obj 22 252 int;
$1 msg 22 278 /fout/lev/name pd-1010-dfb;
$1 connect 1 0 6 0;
$1 connect 2 0 4 0;
$1 connect 4 0 5 0;
$1 connect 5 0 6 1;
$1 connect 5 1 6 2;
$1 connect 6 0 7 0;
$1 connect 7 0 8 0;
$1 connect 8 0 9 0;
$1 connect 9 0 10 0;
$1 connect 10 0 3 0;
$1 restore 127 223 pd f_instance;

So, is it the canvas/restore messages that are crashing Pd, and if so, 
is there some other way to dynamically created subpatches inside another 
subpatch?

Thanks for reading,

Phil Stone
www.pkstonemusic.com





More information about the Pd-list mailing list