On Thu, 10 Jul 2008, Martin Peach wrote:
Rich E wrote:
Now, I want to turn write a set of externals using a buffered analysis. Originally, I thought that all operations to the buffer would happen using one external, but this now seems like it will get too messy once anything more than basic operations are attempted (something like cross-synthesis would take enough code to constitude its own external). So, I have decided that, like the process of SMS, the different modes of operation should be seperated into analysis, synthesis, and editing. However, they would all still need access to the same buffer (which could also be its own external, or possibly be inside the analysis external).
So now I am looking for a way to make it where various externals have access to the same buffer - a data structure containing a header and sequential frames of analysis.
I originally thought that outputting a pointer would be the easiest, but then realized that pd can output 'gpointers', which are not the same as a void pointer. So it does not look possible to pass a regular c pointer around in pd land.
If you have pd-extended or apply the string patch http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/packages/patches... , you can use t_blobs as a kind of atom:
typedef struct _blob /* pointer to a blob */ { unsigned long s_length; /* length of blob in bytes */ unsigned char *s_data; /* pointer to 1st byte of blob */ } t_blob;
It's totally up to you as The Programmer to keep track of the memory, Pd only passes the pointers around.
It would be great to have people start using this string/blob functionality, but it needs to be changed so that it'll work without patching Pd itself. IOhannes outlined this idea, and we talked about it briefly in the past.
This current implementation of the string patch will need to be removed from the next release of Pd-extended (and should have been removed from this release).
The core of the idea that IOhannes mentioned is just declaring an external type number and using that, rather than patching Pd.
.hc
Martin
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
zen \ \ \[D[D[D[D