[PD] RE : Re: first exercise with data structures

colet.patrice colet.patrice at free.fr
Tue May 28 13:12:00 CEST 2013


Datastructure behaves exactly like C language, if all variables and functions are already writen on a paper or with merise or UML, like it would usually be done with a c or c++ program, variable naming and memory allocation becomes easier. In C this is exactly the same method for accessing a place in memory, traversing a template, from pointer to another, if you want to access directly a particular place in memory, use arrays instead. It's possible to change scalars with textfile like I suggested in my first message in this topic.




Patrice Colet 

-------- Message d'origine --------
De : Roman Haefeli <reduzent at gmail.com> 
Date : 28/05/2013  9:57  (GMT+00:00) 
A : pd-list <pd-list at iem.at> 
Objet : Re: [PD] first exercise with data structures 
 
Thanks for sharing your mind on the topic.

Probably this has already been covered as a limitation and may I haven't
really understood it. There is one thing troubling me at the moment.
From what I can see, you can easily get data out of your data structure.
And for what I am trying, editing data manually/per GUI is quite easy.
But how to set data programmatically, i.e. by message? As you can only
change a certain scalar by setting a pointer to it, the only way I see
is to traverse all scalars until you find the one you want to change. Is
this currently the only way to change a property of a particular scalar?

Roman


On Sam, 2013-05-25 at 12:13 +0200, João Pais wrote:
> jonathan already gave a smart reply to your question, using variable  
> variables as delimiters in your polygons, you can vary everything. If you  
> notice, in your first example you could vary the position of the  
> individual array elements (because you don't have a fixed x distance), but  
> you couldn't vary the position of the whole array - which wasn't necessary  
> for now, but I just wanted to remark that.
> 
> I would add only something to your [setsize bar_struct bar_array]  
> construct: in case you want to get a pointer of a specific template, use  
> the template's name as argument e.g. [pointer bar_struct], and route the  
> exit of the 2nd outlet to a [next(. That creates a loop that only stops  
> when you get your pointer. if you have several scalars of the same  
> template, adding a [get ...] to that loop makes it better (in case you  
> have a sort of identifier for each scalar).
> 
> A not-so-efficient-as-Jonathan's example of dynamic polygons can be seen  
> in my [jmmmp/bezier] abstraction (attached also the upcoming audio  
> version). Inside my folder are a couple other abstractions using data  
> structures (some new ones might appear only in the next pd-ext release).
> 
> I wouldn't say "don't bother with data structures", but rather "work a lot  
> with it and make pressure so that they get improved". besides Jonathan's  
> remarks, there are many other simple things that make life harder: lack of  
> methods for simple operations (select previous pointer, or previous/next X  
> pointers), math or expr functions inside of data-s templates (you need to  
> get the data and then set it again), can't delete scalars without using  
> the delete key or clearing the whole canvas, ...
> many small things that make one patch a lot just to make simple operations.
> and the biggest problem, rendering. don't even try to think of using  
> data-s for any high-rate GUI. for that better to look at GEM.
> 
> looking at Miller's words, data structures was one of the main reasons to  
> start Pd. after all this time, they didn't change that much.
> 
> very nice would be to have Ircam's FTM library implemented in Pd, but it  
> seems to be an impossible task, someone has tried already.
> 
> 
> > On Fre, 2013-05-24 at 16:13 -0700, Jonathan Wilkes wrote:
> >> Here's a quickly made approach that uses quanta syntax and checks
> >> for mouse manipulations from the outlet of [struct].
> >
> > Thanks a lot. A lot of new stuff (for me) in your example.
> >
> >> I wouldn't recommend spending too much time learning data structures.
> >> They are _extremely_ limited with the current implementation.
> >
> > I appreciate your advice. I have the impression one finds out about the
> > limitations only by diving into data structures a bit more deeply.
> > Although I haven't a clear picture yet what is possible and what is not,
> > I find some of the examples in Millers documentation quite intriguing.
> >
> > Roman
> >
> >
> >> ----- Original Message -----
> >> From: Roman Haefeli <reduzent at gmail.com>
> >> To: pd-list <pd-list at iem.at>
> >> Cc:
> >> Sent: Friday, May 24, 2013 6:15 PM
> >> Subject: [PD] first exercise with data structures
> >>
> >> Hi all
> >>
> >> Finally an attempt to dive into data structures. I read Frank
> >> Barknecht's still excellent DS tutorial and, of course, section 4 of
> >> Pd's help written by Miller Puckette, which is a bit more demanding, but
> >> definitely very interesting. Though I can somewhat follow the simpler
> >> example patches, the fundamental concepts are still a bit nebulous.
> >>
> >> Here's my problem. I found how to use [filledpolygon] to draw a
> >> rectangle whose width can be changed by mouse interaction. When using
> >> the same [struct] as the element of an array, I can draw many rectangles
> >> which can be grabbed and moved by the mouse (x-y-array). However, when
> >> it is used as an element, the ability to change the width dynamically
> >> with the mouse is lost.  When it is not part of an array, it cannot be
> >> moved easily (without going into edit mode). How can I have both at the
> >> same time? Is it even possible at all?
> >>
> >> Attached is an example that illustrates both cases.
> >>
> >> Roman
> >>
> >> _______________________________________________
> >> Pd-list at iem.at mailing list
> >> UNSUBSCRIBE and account-management ->  
> >> http://lists.puredata.info/listinfo/pd-list
> >
> >
> >
> > _______________________________________________
> > Pd-list at iem.at mailing list
> > UNSUBSCRIBE and account-management ->  
> > http://lists.puredata.info/listinfo/pd-list
> 
> 



_______________________________________________
Pd-list at iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20130528/325688e3/attachment.htm>


More information about the Pd-list mailing list