Hi Rory,
Rory Walsh wrote:
I have an absraction that contains an array. Every
time I load more than one absraction I get warnings
due to the arrays being the same name, of course I
could manually change the array names within each
abstraction, but is there an easier way to do this?
Cheers,
Rory.
Besides using $0, there are some other tricks, epsc if you want to be
able to use [soundfiler] to load different files to each, in the case of
an audio array. I had trouble using two different $n variables in one
message, so I cooked up the following patch as an example of how to do
it. Call it as an abstraction, and you shold be able to load diffreent
sounds to each array.
best,
d.
--
derek holzer :::
http://www.umatic.nl
---Oblique Strategy # 36:
"Consult other sources
-promising
-unpromising"
#N canvas 189 180 813 482 16;
#N canvas 174 17 547 348 loader 0;
#X obj 68 36 inlet bang_to_load_file;
#X obj 68 285 outlet file_length_in_samples;
#X obj 68 63 openpanel;
#X obj 68 253 soundfiler;
#X msg 90 141 0;
#X msg 90 193 add $1;
#X msg 68 88 set read -resize $1;
#X text 250 117 this is a little trick;
#X text 251 131 to make a compound message;
#X text 252 144 with two $-n arguments!;
#X msg 68 222;
#X obj 68 114 t b b a;
#X obj 90 167 makefilename $0-sound;
#X obj 203 63 table $0-sound;
#X connect 0 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 1 0;
#X connect 4 0 12 0;
#X connect 5 0 10 0;
#X connect 6 0 11 0;
#X connect 10 0 3 0;
#X connect 11 0 10 0;
#X connect 11 1 4 0;
#X connect 11 2 10 0;
#X connect 12 0 5 0;
#X restore 107 70 pd loader;
#X obj 107 44 inlet bang_to_load_file;
#X text 200 69 <---output is file length in samples;
#X obj 8 248 line~;
#X obj 8 221 pack 0 0;
#X obj 152 184 / 44.1;
#X obj 8 184 f;
#X obj 107 141 t f f;
#X text 233 185 <---remember to change to 48 for 48KHz sampling rate!
;
#X obj 8 100 t b b;
#X msg 38 141 0;
#X obj 9 329 outlet~ audio_out;
#X obj 8 13 inlet 1_or_0_to_start_and_stop;
#X obj 8 44 select 1;
#X text 93 101 <---first set [line~] to zero , then send target;
#X text 118 220 <---tell [line~] to go to x-sample in y-miliseconds
;
#X text 184 142 <---first gives time , then target , for [line~]
object;
#X text 490 375 derek@x-i.net;
#X obj 9 275 +~ 1;
#X obj 9 302 tabread4~ $0-sound;
#X connect 0 0 7 0;
#X connect 1 0 0 0;
#X connect 3 0 18 0;
#X connect 4 0 3 0;
#X connect 5 0 4 1;
#X connect 6 0 4 0;
#X connect 7 0 6 1;
#X connect 7 1 5 0;
#X connect 9 0 6 0;
#X connect 9 1 10 0;
#X connect 10 0 3 0;
#X connect 12 0 13 0;
#X connect 13 0 9 0;
#X connect 13 1 10 0;
#X connect 18 0 19 0;
#X connect 19 0 11 0;