[PD] [datastruct] calculations inside drawing instructions

federico xaero at inwind.it
Sat Apr 9 01:48:08 CEST 2005


>Perhaps you want to compare your solution to the datastruct  adsr
>envelope which is in Frank Barknecht s data structures tutorial:
>http://puredata.info/community/projects/convention04/lectures/tk-barknecht/tut.tgz
>it s file 18-tut.pd, and you have to have grob-library.pd open
>  
>

i looked at that patch, but it is not so good... really it allows you to 
set more parameters than needed.

for now i got working a representation of A,D,S,R values with datastruct:
http://xaero.ath.cx/cms/data/pd/dstruct_adsr_fix2.pd

but this task is pretty useless. the useful part of datastructures is 
that the user manipulate the vector *directly*.
but it is a harder work to let the user modify the adsr graph and keep 
the structure "tidy" (for tidy i mean: when the user drag the attack 
time, the patch has to set 
decay=attack_x+previous_decay_x-previous_attack_x,  release=attack_x+... 
and so on...)

here i notice the absence of separation between model's data and view's 
data (did you ever hear about MVC concept?).
practically: the view part (V) shows some values, but the model part (M) 
keep other values. in addiction: the V part translate user input (on 
itself) into values suitable for data, and viceversa, when model's data 
changes, the view updates itself.
if [drawpolygon] (and other drawing instructions) could (should!) do 
calculations inside them, this part would be done automagically.
just for a structure like this, it is a pain in the ass maintain M and V 
in sync. (i can't still make a full working example). imagine yourself 
what could happen with a more complex structure.

in addition, having model separate from view, allows you to have many 
views that belongs to one data-structure, and this is good.

sorry if the tone of my post sounds surly, it is not my intention.
i think my english is not so good too :)

-- 
Federico




More information about the Pd-list mailing list