[PD] Data structure loop selection

Frank Barknecht fbar at footils.org
Sat Feb 3 10:23:26 CET 2007


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

> I have made an abstraction for a table loop selection with data structure.
> That's the first I made with data structure, so I suposse there are some
> mistakes 

There's a big mistake where you do the data subpatch traversal: There
is no subpatch [pd 1_table] in your patch but still you try to do a
[traverse pd-1_table(. Instead there is a [pd $1_table] subpatch. 
You should use something like 
 
 [symbol pd-$1_table]
 |
 [traverse $1(

instead, if you're using Pd 0.40, or 

 [symbol $1_table]
 |
 [makefilename pd-%s]
 |
 [traverse $1(

for older Pds.

> and some things I would like to improve:
> - I would like to limit init and end point rango between 0 and 100, that way
> I could't drag either the init point down to 0 or the end point up to 100.

Check out the 09.scaling.pd help patch in the docs. You need to use a
different syntax to paint, it looks something like this "x(0:100)(0:100)"

However for what you want to do, you need to change other parts of the
patch as well and intruduce a "dummy-X"-coordinate. See attached
patch.


> - I don't know why I have two times the init and end markers (I only want
> one init marker and another end marker)

Probably one was saved with the patch. If you clear the subpatch and
put the markers on again, everything's fine.

> - How can I modify either the init or end markers from an external value
> (via receive)

You can send and receive pointers. Just get a pointer to one of the
markers using for example traversal, then send that pointer somewhere,
where you have a [set init x] object or so. 

You can also store the received pointer in a [pointer] object, if you
want to reuse it several times just like a [float] or [symbol].

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N struct limited float x float y float dummy-x;
#N canvas 408 231 450 300 10;
#N canvas 383 206 852 549 limited 1;
#X text 83 153 Red: No scaling applied:;
#X text 80 206 Black: scaling applied;
#X obj 669 429 pointer;
#X obj 669 343 makefilename pd-%s;
#X obj 669 320 symbol subpatch;
#X obj 492 326 inlet;
#X obj 492 346 t b a;
#X obj 82 80 route select;
#X obj 82 103 outlet;
#X msg 669 408 traverse \$1 \, bang;
#X obj 82 53 struct limited float x float y float dummy-x;
#X obj 492 463 append limited x y dummy-x;
#X text 409 146 border;
#X msg 544 322 painter;
#X obj 410 179 drawpolygon 666 1 0 0 0 100 100 100 100 0 0 0;
#X msg 716 365 \; \$1 clear;
#X obj 669 366 t a a;
#X obj 84 177 drawpolygon 900 3 dummy-x 0 dummy-x 50;
#X obj 81 229 drawpolygon 0 3 dummy-x(0:100)(0:100) 50 dummy-x(0:100)(0:100)
100;
#X msg 492 423 100 100 30;
#X obj 199 82 drawnumber dummy-x 0 -20 0 dummy-x=;
#X text 82 315 Blue: Funky scaling;
#X obj 81 345 drawpolygon 8 3 dummy-x(0:100)(10:110) 50 dummy-x(50:1)(100:50)
100;
#X connect 2 0 11 3;
#X connect 3 0 16 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X connect 6 0 19 0;
#X connect 6 1 4 0;
#X connect 7 0 8 0;
#X connect 9 0 2 0;
#X connect 10 0 7 0;
#X connect 13 0 6 0;
#X connect 16 0 9 0;
#X connect 16 1 15 0;
#X connect 19 0 11 0;
#X restore 75 67 pd limited;
#N canvas 0 0 450 300 painter 1;
#X scalar limited 100 100 51 \;;
#X restore 235 68 pd painter;
#X msg 75 42 painter;
#X connect 2 0 0 0;


More information about the Pd-list mailing list