On 7/8/07, Mathieu Bouchard matju@artengine.ca wrote:
On Sat, 7 Jul 2007, Charles Henry wrote:
I was wondering if you could clarify for me what types of data structures you are pointing to, because I could think of an application that this would solve.
In modern GridFlow, "grid" messages (the only special messages in GridFlow) contain one single fake pointer which is always pointing to a GridOutlet structure. When an object receives that, it calls ->callback(x) on the structure, where x has to be a GridInlet*. This subscribes the GridInlet to the streaming that will be performed by the GridOutlet as soon as the message handler returns.
I think I understand now. You pass pointers to structures. That makes a lot of sense.
As of now, this is always ever done by grid.c, so actual grid-handling pd classes named like [#whatever] never know about this and it could actually change from version to version (and it did). When patching, you are not allowed to assume anything about the contents of the grid message.
For a while now, I was wondering how to include a wave packets transform in pd. The wave++ library has a wave packets transform, where the structure of the transform is provided as a tree, and the tree is a class.
We've had an experimental datatype in LTI (a C++ library wrapped by GridFlow) for pointing to special (non-gridoutlet) structs like that but it's not like we're so proud of it.
Btw, if that's a balanced tree, it's rather easy to flatten it into an array in a predictable way. You've thought about that? (Are you talking about wavelets?)
The wave packets transform is a wavelet transform, in which each of the branches with greater than 1 point can be expaned in the same manner. The big idea of using one is to do a best basis search, which depends on the signal characteristics. So, the best basis can be drastically different from one signal to another. I am sure there is a way to flatten the tree into an array, with various extra parameters that tell you how to traverse the tree as moving to different indexes of the array. You're certainly correct. I really hadn't thought of that before. The existing wave++ library has functions on classes. So to flatten the tree for passing, only to be un-flattened afterwards is less efficient than to pass a pointer to the tree.
But really..... it's a pretty impractical example there would be little need to have these specialized structures as externals, to be passed to other externals. A series of objects that perform some kind of wave packets analysis/processing would only be compatible with each other. If you wanted to do some kind of processing on the packets, you would have to write another external for it, just to decode the structure anyway. It's really just a curiosity (as far as I can tell) Thanks for describing to me how you pass "fake" pointers :)
Chuck