[PD] automatic object connection

Frank Barknecht fbar at footils.org
Sun Aug 14 23:53:55 CEST 2005


Hallo,
Gerda Strobl hat gesagt: // Gerda Strobl wrote:

> I have a patch for automatic scripting different objects--lets say : i 
> create 10 [metro]s among each other next to them 10 [random]s how   can 
> i connect them automatically?

You need to generate "connect" messages, whose syntax is as follows: 

"connect obj_A outlet_A obj_B inlet_B"

obj_A, outlet_A, obj_B, inlet_B are all numbers. 

The meaning of outlet_A and inlet_B should be clear, but note, that
in/outlets are numbered starting with 0. 

obj_A and obj_B also are numbers, they are given according to creation
order. So basically you need to keep track of these numbers yourself.
The object that was created first gets the number "0", the second is
number "1", the third gets a "2" and so on. 

If you created these objects using dynamic messages: 

obj 10 0 metro 100
obj 10 25 random 200

then this message will connect the metro to the random as you would
usually do by hand: 

connect 0 0 1 0

The metro is obj_A==0, the random is obj_B==1, and we use both outlet
and inlet 0, that is, the first.

If you then create another object, say a sender: 

obj 10 50 send randoms

You can connect the "random" to the "send" using: 

connect 1 0 2 0

Now guess, what adding this will do: 

obj 0 0 tgl
connect 3 0 0 0

Attached is an example.

Ciao
-- 
 Frank Barknecht                               _ ______footils.org__
             
          _ __latest track: "plak" @ http://footils.org/cms/show/44
-------------- next part --------------
#N canvas 311 77 739 557 10;
#N canvas 0 0 690 678 cm 1;
#X restore 461 68 pd cm;
#X obj 145 120 until;
#X obj 145 145 f;
#X obj 178 145 + 1;
#X obj 176 91 t f b b;
#X obj 212 262 + 1;
#X text 440 44 built here:;
#X msg 198 116 0;
#X obj 247 143 s pd-cm;
#X msg 247 117 clear;
#X obj 130 383 s pd-cm;
#X obj 145 256 + 25;
#X obj 130 203 * 50;
#X obj 130 286 pack 0 0 0 0;
#X obj 182 198 * 2;
#X floatatom 226 62 5 0 0 0 - - -;
#X obj 182 224 t f f;
#X obj 145 169 t f f;
#X obj 130 226 t f f;
#X obj 213 386 print;
#X msg 130 314 obj 10 \$1 metro 100 \, obj 10 \$2 random 200 \, connect
\$3 0 \$4 0;
#X msg 176 66 5;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 17 0;
#X connect 3 0 2 1;
#X connect 4 0 1 0;
#X connect 4 1 7 0;
#X connect 4 2 9 0;
#X connect 5 0 13 3;
#X connect 7 0 2 1;
#X connect 9 0 8 0;
#X connect 11 0 13 1;
#X connect 12 0 18 0;
#X connect 13 0 20 0;
#X connect 14 0 16 0;
#X connect 15 0 4 0;
#X connect 16 0 13 2;
#X connect 16 1 5 0;
#X connect 17 0 12 0;
#X connect 17 1 14 0;
#X connect 18 0 13 0;
#X connect 18 1 11 0;
#X connect 20 0 10 0;
#X connect 20 0 19 0;
#X connect 21 0 4 0;


More information about the Pd-list mailing list