[PD-dev] sms pd external - design choices

Martin Peach martin.peach at sympatico.ca
Fri Jul 11 03:29:07 CEST 2008


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/add_string_support.patch?view=log
, 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.

Martin




More information about the Pd-dev mailing list