After screwing around with ds for awhile, I figured out that if you scale a 
point on a polygon or curve in the opposite direction of the y-scale for the 
plot, you get an anchored point that doesn't move, as in the attached 
bargraph.pd.  Same thing works for drawnumber.

When I tested this using Miller's 0.42-0test06, I noticed some new features for 
data structures:
1.  Clicking a ds graphical object in non-editmode outputs a "click" message, 
pointer, and y-value from the corresponding struct.
2.  Clicking a plotted array outputs a series of lists: one for each element of 
the array.  These lists come out of the struct box for the ds defined as the 
element of that array-- "bar" in my example.  However, I can't figure out what 
the pointer in this list is pointing at: I get an empty/stale pointer error if 
I try to use it for either of the ds I created.

I also made a little scrolling bar graph test to get some heavy use out of ds 
while dealing with sound.  In barscroll.pd, traversing the array every 40ms 
works fine with about 30 elements (at least with the simple, gritty sounds I'm 
using), but with 200 both video and audio get chopped up considerably.  
Sluggish redrawing seems to affect all data structures, too-- even in other 
patches.

Finally, I noticed a few things that might be nice additions to ds, if they're 
possible and/or desirable:

* quantization by variable: y0(0:100)(10:110)(variable)
* jump-on-click flag
* vertical plot
* drawsymbol outputting +1 or -1 msg (& pointer) on change
* keyboard entry for drawsymbol (same as drawnumber)
* fonts/sizes for drawnumber/drawsymbol
* ability to change pixels per increment for drawnumber
* [drawinlet var x y]
* [drawoutlet var x y -onClick -onSelect etc.]
* individual elements of an array outputting a list to the struct when changed
* some way to define a selectable size for grobs that move in non-editmode
* constraints on drawnumber scrolling when scaled
* have drawnumber ignore non-numeric input (instead of jumping to zero)

I have no idea how to implement any of these, but I hope at least a few of them 
would be generally useful.

-Jonathan

--- On Tue, 12/2/08, Jonathan Wilkes <jancs...@yahoo.com> wrote:

> From: Jonathan Wilkes <jancs...@yahoo.com>
> Subject: Re: [PD] Multi-slider attempt
> To: "Hans-Christoph Steiner" <h...@eds.org>, "hard off" <hard....@gmail.com>
> Cc: "PD-List" <pd-list@iem.at>
> Date: Tuesday, December 2, 2008, 2:53 AM
> I haven't put it to practical use yet.  But if I
> weren't using arrays, I would just have a scalable
> rectangle, for example, and get the y-value from the outlet
> of the corresponding struct.  When stretching the rectangle,
> it gives a "change" message plus a pointer to the
> object, so there's no need to poll.
> 
> But a struct won't output anything when moving an array
> element.  If it did, then maybe it's as simple as using
> [tabwrite] to link to a table for audio processing.
> 
> 
> --- On Mon, 12/1/08, hard off <hard....@gmail.com>
> wrote:
> 
> > From: hard off <hard....@gmail.com>
> > Subject: Re: [PD] Multi-slider attempt
> > To: "Hans-Christoph Steiner"
> <h...@eds.org>
> > Cc: "PD-List" <pd-list@iem.at>
> > Date: Monday, December 1, 2008, 5:47 AM
> > i understand your question, and unfortunately
> don't have
> > the answer because
> > datastructs are a bit foreign to me.
> > 
> > however...if you are going to use this structure for
> > controlling audio or
> > visual processes, then won't you need to
> constantly
> > poll the y-values of the
> > handles anyway?
> > _______________________________________________
> > Pd-list@iem.at mailing list
> > UNSUBSCRIBE and account-management ->
> > http://lists.puredata.info/listinfo/pd-list
> 
> 
>       
> 
> _______________________________________________
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list


      
#N canvas 0 0 450 184 10;
#N canvas 0 0 507 636 bar 1;
#X obj 168 54 filledpolygon y y 5 -5 5 5 5 5 y(0:127)(5:132) -5 y(0:127)(5:132)
;
#X obj 168 121 drawnumber y -5 -20 c;
#X obj 168 94 drawnumber y -5 y(0:127)(10:137) c;
#X obj 122 27 struct bar float y float c;
#X obj 122 281 f;
#X obj 179 308 + 1;
#X msg 202 256 0;
#X msg 245 300 traverse pd-paint \, next;
#X obj 245 327 pointer graph;
#X msg 282 354 next;
#X obj 122 348 element graph bars;
#X obj 122 402 get bar y;
#X obj 122 432 +;
#X obj 122 454 t a;
#X obj 122 481 /;
#X obj 122 308 t a a;
#X obj 122 514 set graph mean;
#X obj 25 472 set bar c;
#X obj 122 375 t a a;
#X obj 290 194 del 10;
#X msg 290 169 stop;
#X msg 290 226 1;
#X obj 245 273 spigot 1;
#X msg 290 251 0;
#X msg 25 445 9;
#X obj 202 415 t a;
#X obj 218 204 t b b;
#X msg 64 445 0;
#X obj 25 419 sel 127 0;
#X obj 122 152 t b b b;
#X connect 3 0 29 0;
#X connect 4 0 15 0;
#X connect 5 0 4 1;
#X connect 5 0 14 1;
#X connect 6 0 4 1;
#X connect 6 0 25 0;
#X connect 7 0 8 0;
#X connect 8 0 10 1;
#X connect 8 0 16 1;
#X connect 8 1 9 0;
#X connect 9 0 8 0;
#X connect 10 0 18 0;
#X connect 11 0 12 0;
#X connect 11 0 28 0;
#X connect 12 0 13 0;
#X connect 13 0 12 1;
#X connect 13 0 14 0;
#X connect 14 0 16 0;
#X connect 15 0 10 0;
#X connect 15 1 5 0;
#X connect 18 0 11 0;
#X connect 18 1 17 1;
#X connect 19 0 6 0;
#X connect 19 0 21 0;
#X connect 20 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 7 0;
#X connect 23 0 22 1;
#X connect 24 0 17 0;
#X connect 25 0 12 1;
#X connect 26 0 23 0;
#X connect 26 1 22 0;
#X connect 27 0 17 0;
#X connect 28 0 24 0;
#X connect 28 1 24 0;
#X connect 28 2 27 0;
#X connect 29 0 4 0;
#X connect 29 1 19 0;
#X connect 29 1 26 0;
#X connect 29 2 20 0;
#X restore 19 24 pd bar;
#N canvas 409 1 437 654 paint 1;
#X restore 71 24 pd paint;
#N canvas 0 0 489 475 graph 0;
#X obj 127 83 plot curve -y y(0:127)(0:-127) bars 999 1 20 0 25;
#X obj 127 110 drawpolygon 777 2 0 -127 0 30 400 30;
#X obj 101 36 struct graph float x float y array bars bar float mean
;
#X obj 130 135 drawnumber mean 0 40 0 mean=;
#X restore 19 78 pd graph;
#N canvas 0 0 317 611 init 0;
#X obj 107 155 pointer;
#X msg 107 122 traverse pd-paint \, bang;
#X obj 14 182 append graph x y;
#X msg 14 145 10 200;
#X obj 48 285 setsize graph bars;
#X obj 14 14 loadbang;
#X msg 208 84 \; pd-paint clear;
#X obj 14 45 t b b b;
#X msg 33 251 16;
#X obj 41 472 element graph bars;
#X obj 14 206 t a b a;
#X obj 14 383 until;
#X obj 14 361 f;
#X obj 14 408 f;
#X obj 44 408 + 1;
#X obj 14 439 t b a;
#X obj 14 526 set bar y;
#X obj 14 499 random 127;
#X obj 14 312 t b b a;
#X msg 52 384 0;
#X obj 118 14 inlet;
#X msg 74 13 bang;
#X connect 0 0 2 2;
#X connect 1 0 0 0;
#X connect 2 0 10 0;
#X connect 3 0 2 0;
#X connect 5 0 7 0;
#X connect 7 0 3 0;
#X connect 7 1 1 0;
#X connect 7 2 6 0;
#X connect 8 0 4 0;
#X connect 8 0 12 1;
#X connect 9 0 16 1;
#X connect 10 0 18 0;
#X connect 10 1 8 0;
#X connect 10 2 4 1;
#X connect 11 0 13 0;
#X connect 12 0 11 0;
#X connect 13 0 14 0;
#X connect 13 0 15 0;
#X connect 14 0 13 1;
#X connect 15 0 17 0;
#X connect 15 1 9 0;
#X connect 17 0 16 0;
#X connect 18 0 12 0;
#X connect 18 1 19 0;
#X connect 18 2 9 1;
#X connect 19 0 13 1;
#X connect 20 0 21 0;
#X connect 21 0 7 0;
#X restore 80 79 pd init;
#X text 129 24 <- bargraph inside;
#X obj 80 59 bng 15 250 50 0 empty empty reset 17 7 0 10 -262144 -1
-1;
#X connect 5 0 3 0;
#N canvas 11 0 566 681 12;
#N canvas 33 3 578 457 attack 0;
#X obj 120 50 struct attack float y0 float c;
#X obj 69 119 filledpolygon c 0 1 -2 2 2 2 2 y0(21:108)(2:437) -2 
y0(21:108)(2:437)
;
#X restore 9 282 pd attack;
#N canvas 603 0 401 442 paint 1;
#X restore 9 342 pd paint;
#N canvas 0 0 558 373 graph 0;
#X obj 55 30 struct graph float x float y array attacks attack;
#X msg 236 145 traverse pd-paint \, next;
#X obj 145 208 element graph attacks;
#X floatatom 148 288 5 0 0 0 - - -;
#X obj 278 170 pointer;
#X obj 146 244 get attack y0 c;
#X floatatom 248 298 5 0 0 0 - - -;
#X floatatom 137 168 5 0 0 0 - - -;
#X obj 55 65 plot -y y0(108:21)(0:435)(1) attacks 555 2 0 0 -10;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 4 0 2 1;
#X connect 5 0 3 0;
#X connect 5 1 6 0;
#X connect 7 0 2 0;
#X restore 9 312 pd graph;
#X msg 104 490 traverse pd-paint \, next;
#X obj 104 514 pointer;
#X obj 9 557 element graph attacks;
#X obj 9 585 t a a;
#X obj 9 680 f;
#X obj 9 641 t a b;
#X obj 9 461 f 1;
#X obj 9 491 until;
#X obj 9 525 f;
#X obj 44 525 + 1;
#X msg 62 490 0;
#X obj 9 420 t b a b;
#X obj 251 363 mtof;
#X obj 274 548 line~;
#X obj 251 454 *~;
#N canvas 0 85 1004 682 slider-template 0;
#X obj 752 284 pointer;
#X obj 627 326 append slider y0;
#X obj 306 20 struct slider float x float y float y0;
#X msg 627 283 0;
#X obj 306 140 route change;
#X msg 306 195 1;
#X msg 352 220 0;
#X obj 352 196 del 1500;
#X msg 752 250 traverse pd-slider \, bang;
#N canvas 460 336 450 301 slider 0;
#X coords 0 0 15 128 15 128 1;
#X restore 6 7 pd slider;
#X obj 627 154 loadbang;
#X msg 693 181 \; pd-slider clear;
#X obj 627 181 t b b b;
#X obj 90 23 inlet;
#X obj 191 340 pointer;
#X obj 90 420 set slider y0;
#X obj 306 167 t b a;
#X obj 480 423 get slider y0;
#X obj 480 289 unpack p 0;
#X obj 480 453 outlet;
#X obj 90 239 t a b;
#X obj 90 58 route float set bang;
#X obj 142 240 t a b;
#X msg 191 310 traverse pd-slider \, next;
#X obj 229 403 spigot;
#X obj 194 240 t b b b;
#X msg 247 268 1;
#X msg 194 270 0;
#X obj 732 150 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 561 356 \; pd-slider donecanvasdialog 1 -1 2 0 0 15 128 15 128
0 0;
#X obj 323 53 filledpolygon 99 99 1 0 0 0 138 15 138 15 0;
#X obj 323 87 filledcurve 900 0 1 1 y0(0:127)(127:0) 14 y0(0:127)(127:0)
14 y0(0:127)(137:10) 1 y0(0:127)(137:10);
#X obj 306 248 drawnumber y0 25 y0(0:127)(124:-3);
#X connect 0 0 1 1;
#X connect 2 0 4 0;
#X connect 3 0 1 0;
#X connect 4 0 16 0;
#X connect 5 0 32 0;
#X connect 6 0 32 0;
#X connect 7 0 6 0;
#X connect 8 0 0 0;
#X connect 10 0 12 0;
#X connect 12 0 3 0;
#X connect 12 0 29 0;
#X connect 12 1 8 0;
#X connect 12 1 6 0;
#X connect 12 2 11 0;
#X connect 13 0 21 0;
#X connect 14 0 15 1;
#X connect 14 0 24 0;
#X connect 16 0 5 0;
#X connect 16 0 7 0;
#X connect 16 1 18 0;
#X connect 17 0 19 0;
#X connect 18 0 17 0;
#X connect 20 0 15 0;
#X connect 20 0 19 0;
#X connect 20 1 23 0;
#X connect 21 0 20 0;
#X connect 21 1 22 0;
#X connect 21 2 25 0;
#X connect 22 0 15 0;
#X connect 22 1 23 0;
#X connect 23 0 14 0;
#X connect 24 0 17 0;
#X connect 25 0 27 0;
#X connect 25 1 23 0;
#X connect 25 2 26 0;
#X connect 26 0 24 1;
#X connect 27 0 24 1;
#X connect 28 0 12 0;
#X coords 0 0 60 150 60 150 2 0 0;
#X restore 456 277 pd slider-template;
#X msg 274 518 \$1 25;
#X obj 313 407 line~;
#X obj 251 303 t a b b;
#X msg 367 329 stop;
#X obj 252 577 *~;
#X obj 253 605 dac~;
#N canvas 0 0 171 222 octatonic 0;
#X obj 18 9 inlet;
#X obj 18 42 t a a;
#X obj 55 72 div 2;
#X obj 55 102 int;
#X obj 34 140 +;
#X obj 34 177 outlet;
#X connect 0 0 1 0;
#X connect 1 0 4 0;
#X connect 1 1 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 4 0 5 0;
#X restore 251 273 pd octatonic;
#N canvas 0 0 450 300 fm~ 0;
#X obj 133 25 inlet;
#X obj 350 31 inlet;
#X obj 135 183 osc~;
#X obj 134 130 +~;
#X obj 225 140 *~;
#X obj 136 228 outlet~;
#X obj 225 94 osc~;
#X obj 303 106 *;
#X obj 334 65 / 16;
#X connect 0 0 3 0;
#X connect 0 0 6 0;
#X connect 0 0 7 0;
#X connect 1 0 8 0;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 3 1;
#X connect 6 0 4 0;
#X connect 7 0 4 1;
#X connect 8 0 7 1;
#X restore 251 407 pd fm~;
#X obj 337 461 hsl 50 15 0 100 0 0 empty empty volume -2 -8 0 18 -4032
-1 -1 3700 1;
#X obj 334 482 dbtorms;
#X obj 251 20 tgl 25 0 empty empty Go 30 15 0 14 -4032 -258113 -1 0
1;
#X obj 284 155 + 1;
#X floatatom 312 65 5 0 0 0 - - -;
#X msg 285 211 1;
#X msg 321 211 -1;
#X obj 251 155 f;
#X obj 251 243 + 15;
#X obj 286 183 sel 0 56;
#X obj 9 613 get attack y0 c;
#X obj 9 719 set attack y0 c;
#X obj 456 446 / 127;
#X obj 456 470 * 93;
#X obj 456 499 int;
#X obj 112 678 f;
#X obj 111 642 t a b;
#X obj 262 658 f;
#X obj 160 197 random 87;
#X obj 251 128 spigot;
#X obj 160 167 spigot;
#X obj 160 85 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -4032 -1
-1 1;
#X obj 160 127 == 0;
#X text 105 80 random;
#X text 194 79 ramp;
#X obj 160 20 loadbang;
#X msg 160 50 1;
#X obj 251 91 metro 40;
#N canvas 0 0 450 300 init 0;
#X obj 278 351 outlet;
#X msg 133 113 \; pd-paint clear;
#X obj 110 198 pointer;
#X msg 110 159 traverse pd-paint \, bang;
#X obj 87 263 append graph x y;
#X msg 87 228 0 0;
#X obj 64 353 setsize graph attacks;
#X obj 64 55 loadbang;
#X msg 64 298 30;
#X obj 64 79 t b b b b;
#X obj 295 63 loadbang;
#X msg 295 91 \; pd dsp 1;
#X connect 2 0 4 2;
#X connect 3 0 2 0;
#X connect 4 0 6 1;
#X connect 5 0 4 0;
#X connect 7 0 9 0;
#X connect 8 0 6 0;
#X connect 8 0 0 0;
#X connect 9 0 8 0;
#X connect 9 1 5 0;
#X connect 9 2 3 0;
#X connect 9 3 1 0;
#X connect 10 0 11 0;
#X restore 9 372 pd init;
#X obj 172 259 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -8 0
12 -4032 -258113 -1 29 256;
#X text 85 342 <- visualization;
#X text 436 252 timbre/color;
#X text 143 697 way to get blue at the bottom \, red at the top?;
#X msg 313 352 1 20;
#X text 94 255 manual ->;
#N canvas 0 0 775 596 cs 0;
#N canvas 489 209 450 300 control-surface 0;
#X coords 0 0 112 112 112 112 1;
#X restore 0 0 pd control-surface;
#X obj 213 60 struct cs float x0 float y0;
#X msg 397 303 traverse pd-control-surface \, bang;
#X obj 374 175 loadbang;
#X obj 397 333 pointer;
#X obj 295 364 append cs x0 y0;
#X obj 374 206 t b b b;
#X msg 420 257 \; pd-control-surface clear;
#X obj 214 410 route change;
#X obj 214 439 unpack p 0;
#X obj 214 471 get cs x0 y0;
#X obj 214 500 outlet;
#X obj 295 500 outlet;
#X obj 478 176 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 247 100 filledcurve 900 0 1 x0(1:101)(1:101) y0(1:101)(101:1)
x0(1:101)(11:111) y0(1:101)(101:1) x0(1:101)(11:111) y0(1:101)(111:11)
x0(1:101)(1:101) y0(1:101)(111:11);
#X msg 336 406 \; pd-control-surface donecanvasdialog 1 -1 2 0 0 112
112 112 112 0 0;
#X msg 295 303 50 50;
#X connect 1 0 8 0;
#X connect 2 0 4 0;
#X connect 3 0 6 0;
#X connect 4 0 5 2;
#X connect 6 0 16 0;
#X connect 6 0 15 0;
#X connect 6 1 2 0;
#X connect 6 2 7 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 10 1 12 0;
#X connect 13 0 6 0;
#X connect 16 0 5 0;
#X coords 0 0 112 112 112 112 2 0 0;
#X restore 404 55 pd cs;
#X text 413 15 multi-control;
#X text 383 32 (turn off metro to use);
#X text 100 272 pitch;
#X text 99 293 input;
#X obj 404 177 / 100;
#X obj 509 177 / 2;
#X obj 367 353 del 20;
#X msg 367 377 0 20;
#X obj 508 201 + 10;
#X connect 3 0 4 0;
#X connect 4 0 5 1;
#X connect 5 0 6 0;
#X connect 6 0 37 0;
#X connect 6 1 38 2;
#X connect 7 0 38 0;
#X connect 8 0 7 1;
#X connect 8 1 7 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 11 0 5 0;
#X connect 12 0 11 1;
#X connect 13 0 11 1;
#X connect 14 0 9 0;
#X connect 14 1 7 1;
#X connect 14 2 13 0;
#X connect 14 2 3 0;
#X connect 14 2 44 0;
#X connect 15 0 26 0;
#X connect 16 0 23 1;
#X connect 17 0 23 0;
#X connect 18 0 26 1;
#X connect 18 0 39 0;
#X connect 19 0 16 0;
#X connect 20 0 17 1;
#X connect 21 0 15 0;
#X connect 21 1 60 0;
#X connect 21 1 69 0;
#X connect 21 2 22 0;
#X connect 22 0 69 0;
#X connect 23 0 24 0;
#X connect 23 0 24 1;
#X connect 25 0 21 0;
#X connect 25 0 14 0;
#X connect 26 0 17 0;
#X connect 27 0 28 0;
#X connect 28 0 19 0;
#X connect 29 0 54 0;
#X connect 30 0 34 1;
#X connect 31 0 54 1;
#X connect 32 0 30 1;
#X connect 33 0 30 1;
#X connect 34 0 30 0;
#X connect 34 0 35 0;
#X connect 34 0 36 0;
#X connect 35 0 25 0;
#X connect 36 0 32 0;
#X connect 36 1 33 0;
#X connect 37 0 8 0;
#X connect 37 1 43 0;
#X connect 39 0 40 0;
#X connect 40 0 41 0;
#X connect 41 0 44 1;
#X connect 42 0 38 1;
#X connect 43 0 42 1;
#X connect 43 1 42 0;
#X connect 44 0 42 1;
#X connect 45 0 25 0;
#X connect 46 0 34 0;
#X connect 47 0 45 0;
#X connect 48 0 49 0;
#X connect 48 0 46 1;
#X connect 49 0 47 1;
#X connect 52 0 53 0;
#X connect 53 0 48 0;
#X connect 54 0 46 0;
#X connect 54 0 47 0;
#X connect 55 0 9 1;
#X connect 56 0 25 0;
#X connect 60 0 20 0;
#X connect 62 0 67 0;
#X connect 62 0 26 1;
#X connect 62 1 68 0;
#X connect 67 0 40 0;
#X connect 68 0 71 0;
#X connect 69 0 70 0;
#X connect 70 0 20 0;
#X connect 71 0 25 0;
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to