after getting to work the array version of my multipoint-envelope, i
want to create a classic ADSR envelope, without using arrays.
i created a datastruct with fields: x, y, a, d, s, r
it is drawed with:
[drawpolygon 700 2 0 0 a -100 d s r 0]
but this is wrong, because if you set attack=90 and decay=20, you get a
weird line, that is not the classic ADSR envelope rapresentation.
in the fact, the X/Y pairs to draw the polygon, should be:
{0,0} {a,-100} {a+d,s} {a+d+r,0}
(i used brackets to group points)
but it seems that is not possible to put calculations inside drawing
instructions.
so, how this task can be accomplished?
i think it is a good idea begin a thread to talk about what
datastructures miss, because it is a lot important to have the
possibility to do calculations inside those drawing instructions.
(another clamorous example is setting limits/constraints on dstruct's
fields, i.e. not allowing negative numbers)
i hope there is someone interested in this discussion,
cause i'm starting to love datastructures exactly in the moment i
discover what they miss. isn't this fun? :D
bye
--
Federico
#N struct adsr float x float y float a float d float s float r;
#N canvas 400 87 691 584 10;
#N canvas 0 0 450 300 adsr-gui 1;
#X scalar adsr 5 150 55 80 -50 200 \;;
#X restore 14 14 pd adsr-gui;
#N canvas 25 99 450 300 adsr-tmpl 0;
#X obj 24 53 struct adsr float x float y float a float d float s float
r;
#X obj 88 172 drawpolygon 700 2 0 0 a -100 d s r 0;
#X restore 14 35 pd adsr-tmpl;
#X obj 288 52 t b b b b b b b;
#X msg 388 104 \; pd-adsr-gui clear;
#X msg 371 151 traverse pd-adsr-gui \, bang;
#X obj 371 177 pointer;
#X obj 215 247 append adsr x y a d s r;
#X obj 215 213 unpack 0 0 0 0 0 0;
#X msg 142 99 traverse pd-adsr-gui \, next;
#X obj 142 151 pointer;
#X obj 196 285 get adsr a d s r;
#X obj 46 231 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
;
#X obj 118 257 spigot;
#X obj 118 183 t b p;
#X obj 118 288 del 80;
#X floatatom 196 345 4 0 0 0 - - -;
#X floatatom 231 345 4 0 0 0 - - -;
#X floatatom 267 345 4 0 0 0 - - -;
#X floatatom 303 345 4 0 0 0 - - -;
#X obj 46 184 loadbang;
#X obj 288 19 loadbang;
#X msg 215 175 5 150 40 80 -50 200;
#X msg 356 19 bang;
#X connect 2 0 8 0;
#X connect 2 2 21 0;
#X connect 2 5 4 0;
#X connect 2 6 3 0;
#X connect 4 0 5 0;
#X connect 5 0 6 6;
#X connect 7 0 6 0;
#X connect 7 1 6 1;
#X connect 7 2 6 2;
#X connect 7 3 6 3;
#X connect 7 4 6 4;
#X connect 7 5 6 5;
#X connect 8 0 9 0;
#X connect 9 0 13 0;
#X connect 10 0 15 0;
#X connect 10 1 16 0;
#X connect 10 2 17 0;
#X connect 10 3 18 0;
#X connect 11 0 12 1;
#X connect 12 0 14 0;
#X connect 13 0 12 0;
#X connect 13 1 10 0;
#X connect 14 0 9 0;
#X connect 19 0 11 0;
#X connect 20 0 2 0;
#X connect 21 0 7 0;
#X connect 22 0 2 0;