[PD] Structures: get data dynamically

Frank Barknecht fbar at footils.org
Sat Dec 9 15:49:38 CET 2006


Hallo,
raul diaz hat gesagt: // raul diaz wrote:

> I'm taking a look at data structures.
> In the attached patch I'm trying to select an init point and an end point
> for a sample using an "init struct" and an "end struct".
> I can select this init and end point with the mouse but then, I would like
> to use this init and end point information for audio process.
> I can obtain the init point or end point value by means of pointer & get,
> but I would like to obtain this value dynamically, that means, to obtain the
> value each time I change the init or end point.
> How can I obtain this values dynamically? Somebody has any suggestion?

Use pd-0.40, then you can watch the [struct] outlets for "change
(pointer)" messages as in attached patch. With 0.39 or 0.38 IIRC you
cannot use "change", but as a workaround there's a "select" message as
well.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N struct init float x;
#N struct end float x;
#N canvas 763 425 365 321 10;
#X msg 201 42 next;
#X floatatom 186 123 5 0 0 0 - - -;
#X obj 186 69 pointer;
#X text 244 41 output next item;
#X text 182 139 x output;
#X obj 259 70 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 186 14 traverse pd-1_table;
#X obj 186 97 get init x;
#N canvas 763 25 484 283 1_table 1;
#X scalar init 86 \;;
#X scalar end 190 \;;
#N canvas 0 0 450 300 (subpatch) 0;
#X array 1_sample 100 float 2;
#X coords 0 1 99 -1 396 196 1;
#X restore 32 32 graph;
#X restore 26 13 pd 1_table;
#N canvas 199 242 578 236 1_init 0;
#X obj 358 92 pointer;
#X obj 266 35 t b b;
#X msg 266 67 0;
#X obj 266 92 append init x;
#X obj 14 11 struct init float x;
#X msg 358 67 traverse pd-\$1_table \, bang;
#X obj 14 96 drawpolygon 900 3 30 30 30 230;
#X obj 13 124 drawpolygon 900 3 29 30 39 30;
#X obj 13 152 drawpolygon 900 3 29 230 39 230;
#X obj 12 184 drawnumber x 6 10 900 init:;
#X obj 266 11 loadbang;
#X obj 14 40 outlet;
#X connect 0 0 3 1;
#X connect 1 0 2 0;
#X connect 1 1 5 0;
#X connect 2 0 3 0;
#X connect 4 0 11 0;
#X connect 5 0 0 0;
#X connect 10 0 1 0;
#X restore 26 54 pd 1_init;
#N canvas 197 535 562 215 1_end 0;
#X obj 358 92 pointer;
#X obj 276 91 append end x;
#X obj 276 34 t b b;
#X obj 14 11 struct end float x;
#X msg 358 67 traverse pd-\$1_table \, bang;
#X obj 13 57 drawpolygon 900 3 30 30 30 230;
#X obj 13 84 drawpolygon 900 3 32 30 22 30;
#X obj 13 112 drawpolygon 900 3 32 230 22 230;
#X obj 12 144 drawnumber x 4 10 900 end:;
#X obj 276 10 loadbang;
#X msg 276 66 400;
#X obj 14 31 outlet;
#X connect 0 0 1 1;
#X connect 2 0 10 0;
#X connect 2 1 4 0;
#X connect 3 0 11 0;
#X connect 4 0 0 0;
#X connect 9 0 2 0;
#X connect 10 0 1 0;
#X restore 26 175 pd 1_end;
#X floatatom 26 133 5 0 0 0 - - -;
#X obj 26 107 get init x;
#X floatatom 26 255 5 0 0 0 - - -;
#X obj 26 229 get init x;
#X obj 26 75 route change select;
#X obj 26 197 route change select;
#X connect 0 0 2 0;
#X connect 2 0 7 0;
#X connect 2 1 5 0;
#X connect 6 0 2 0;
#X connect 7 0 1 0;
#X connect 9 0 15 0;
#X connect 10 0 16 0;
#X connect 12 0 11 0;
#X connect 14 0 13 0;
#X connect 15 0 12 0;
#X connect 15 1 12 0;
#X connect 16 0 14 0;
#X connect 16 1 14 0;


More information about the Pd-list mailing list