(This time, attachment is *really* attached - sorry!)
I have been using Frank B.'s wonderful abstraction [polypoly] (which is a revision and improvement of [nqpoly]) and getting great results with it. In fact, I'll publish a synth based on it very soon now -- just as soon as I work out this final issue.
I added an extra inlet to [polypoly] in order to be able to send a "clear" message to the [poly] object within it, which manages all the dynamically-created voices. I did this because imperfect input can sometimes drop a note-off and leave a note hanging, and it never gets de-allocated or released by [poly] -- that's what the "clear" message accomplishes.
This actually worked great, with one small problem -- the $0-poly subpatch, which is where the magic of [polypoly] mostly seems to occur, doesn't respond well to editing of its parent. There's dynamic instantiation using $0- variables going on here, and I think that's what is getting messed up by editing -- these extra lines appear in the edited version:
#X obj 50 60 r 1002-in1; #X obj 199 60 r 1002-in2; #X obj 50 200 throw~ 1002-out0; #X obj 199 200 throw~ 1002-out1;
and the subpatch invocation is this:
#N canvas 7 455 362 318 1002-poly 0; (edited)
instead of:
#N canvas 7 455 362 318 $0-poly 0; (original)
These cause startup errors, although after that, everything seems to work fine.
I'm not sure how to correctly edit self-modifying patches such as this. What's the trick? Should I just edit the text directly? I've attached the modified version of [polypoly]. By the way, Frank, will [polypoly] be made available from CVS? I think it's the best thing since sliced bread.
Phil Stone UC Davis
#N canvas 211 82 943 658 10; #X obj 36 31 inlet; #X obj 292 200 moses 1; #X text 567 49 your abstraction is ultimately called with the parameters: <index> <number of objects> <arg1> <arg2> <arg3> <arg4>; #N canvas 7 455 362 318 1002-poly 0; #X obj 50 60 r 1002-in1; #X obj 199 60 r 1002-in2; #X obj 50 200 throw~ 1002-out0; #X obj 199 200 throw~ 1002-out1; #X restore 36 254 pd $0-poly; #X obj 36 227 s $0-in1; #N canvas 220 112 751 428 init 0; #X obj 197 139 symbol $0-poly; #X obj 197 163 makefilename pd-%s; #X obj 197 187 pack s $0; #X msg 204 118 bang; #X text 154 317 This will clear the subpatch and create fake "in/outlets" as senders and receivers.; #X obj 103 206 s $0-subname; #X obj 197 92 b; #X obj 197 69 r $0-init; #X msg 197 230 ; $1 clear ; $1 obj 50 60 r $2-in1 ; $1 obj 199 60 r $2-in2 ; $1 obj 50 200 throw~ $2-out0 ; $1 obj 199 200 throw~ $2-out1 ;; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 0 5 0; #X connect 2 0 8 0; #X connect 3 0 0 0; #X connect 6 0 0 0; #X connect 7 0 6 0; #X restore 343 108 pd init; #X obj 139 31 inlet; #X obj 256 63 loadbang; #X obj 256 108 f $1; #N canvas 0 22 692 559 last-two 0; #X obj 153 175 cnv 15 150 80 empty empty empty 20 12 0 14 -233017 -66577 0; #X text 378 110 first reset (b) , then set new length (f).; #X text 311 195 Right outlet is responsible to first fill the list ; #X text 312 211 Left outlet then only lets the smaller list pass.; #X obj 180 183 list; #X obj 228 113 inlet; #X obj 180 149 inlet; #X obj 180 302 outlet; #X obj 180 228 list split 2; #X obj 228 149 b; #X connect 4 0 8 0; #X connect 5 0 9 0; #X connect 6 0 4 0; #X connect 8 0 4 1; #X connect 8 0 7 0; #X connect 8 2 4 1; #X connect 9 0 4 1; #X restore 386 521 pd last-two; #X obj 386 562 list prepend; #X msg 386 589 ; $1 connect $3 0 $2 0 ;; #X obj 434 359 r $0-subname; #X obj 465 541 r $0-subname; #N canvas 183 178 858 457 finish 0; #X obj 121 185 until; #X obj 156 212 + 1; #X obj 121 284 list prepend; #X obj 121 162 t a b; #X obj 200 255 r $0-subname; #X obj 452 126 r $0-subname; #X obj 77 31 inlet; #X obj 77 67 moses 1; #X text 412 238 Connect [r $0-in1] to first object's first inlet; #X obj 168 185 4; #X obj 121 211 f 4; #X text 167 163 first 4 objects are xlets; #X msg 415 196 ; $1 connect 0 0 4 0 ;; #X msg 121 318 ; $1 connect 1 0 $2 1 ; $1 connect $2 1 2 0 ; $1 connect $2 2 3 0 ;; #X obj 415 165 symbol; #X obj 121 98 t a b; #X text 276 344 Connect all wrapper's middle signal outlet to [s~ $0-out0] ; #X text 276 330 Connect all wrapper's right inlet to [r $0-in2]; #X text 276 359 Connect all wrapper's left signal outlet to [s~ $0-out1] ; #X connect 0 0 10 0; #X connect 1 0 10 1; #X connect 2 0 13 0; #X connect 3 0 0 0; #X connect 3 1 9 0; #X connect 4 0 2 1; #X connect 5 0 14 1; #X connect 6 0 7 0; #X connect 7 1 15 0; #X connect 9 0 10 1; #X connect 10 0 1 0; #X connect 10 0 2 0; #X connect 14 0 12 0; #X connect 15 0 3 0; #X connect 15 1 14 0; #X restore 274 260 pd finish; #X text 612 116 based on: nqpoly (v4) - pix.test.at; #X obj 343 135 s $0-init; #X obj 458 494 r $0-init; #X text 612 140 changes: fbar at footils.org 2006; #X obj 408 390 pack f s s f; #X msg 408 444 ; $2 obj 50 100 polypoly-wrap $3 $1 $4 $5 $6 $7 $8 ;; #X obj 256 135 t b a a a b; #X obj 386 273 t a a b; #X obj 395 31 inlet; #X obj 36 167 pack 0 0 0; #X obj 36 140 - 1; #X obj 36 344 outlet~; #X obj 460 332 symbol $3; #X obj 408 417 list append $4 $5 $6 $7; #X obj 386 494 + 4; #X obj 139 344 outlet~; #X obj 36 287 catch~ $0-out0; #X obj 139 287 catch~ $0-out1; #X text 567 12 usage: polypoly <number of objects> <voice stealing: 0/1> <abstraction name> <up to 4 creation args>; #X obj 36 113 poly $1 $2; #N canvas 0 22 382 282 loadbang 0; #X obj 130 64 inlet; #X obj 130 86 b; #X msg 130 141 ; $1 loadbang; #X obj 167 86 r $0-subname; #X obj 130 113 symbol; #X connect 0 0 1 0; #X connect 1 0 4 0; #X connect 3 0 4 1; #X connect 4 0 2 0; #X restore 256 287 pd loadbang; #X obj 139 227 s $0-in2; #X obj 395 58 unpack f s; #N canvas 0 22 227 234 countto 0; #X obj 60 97 until; #X obj 95 124 + 1; #X obj 60 124 f; #X obj 107 97 0; #X obj 60 77 t a b; #X obj 60 54 inlet; #X obj 60 145 outlet; #X connect 0 0 2 0; #X connect 1 0 2 1; #X connect 2 0 1 0; #X connect 2 0 6 0; #X connect 3 0 2 1; #X connect 4 0 0 0; #X connect 4 1 3 0; #X connect 5 0 4 0; #X restore 386 246 pd countto; #X obj 487 216 f; #X obj 476 33 inlet; #X msg 476 57 clear; #X connect 0 0 34 0; #X connect 1 1 38 0; #X connect 6 0 36 0; #X connect 7 0 8 0; #X connect 8 0 21 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 12 0 19 1; #X connect 13 0 10 1; #X connect 17 0 9 1; #X connect 19 0 28 0; #X connect 21 0 35 0; #X connect 21 1 14 0; #X connect 21 2 1 0; #X connect 21 3 39 0; #X connect 21 4 16 0; #X connect 22 0 29 0; #X connect 22 1 19 0; #X connect 22 2 27 0; #X connect 23 0 37 0; #X connect 24 0 4 0; #X connect 25 0 24 0; #X connect 27 0 19 2; #X connect 28 0 20 0; #X connect 29 0 9 0; #X connect 31 0 26 0; #X connect 32 0 30 0; #X connect 34 0 25 0; #X connect 34 1 24 1; #X connect 34 2 24 2; #X connect 37 0 8 0; #X connect 37 1 27 0; #X connect 38 0 22 0; #X connect 39 0 19 3; #X connect 40 0 41 0; #X connect 41 0 34 0;