[PD-dev] capabilities of data structures with externals

x nor x37v.alex at gmail.com
Sat Jan 4 16:49:05 CET 2020

BTW, I don't think anyone ever answered my first set of questions though
they were sort of loaded with specific information about a specific goal,
though I'm curious in general..

I see in Christof's examples that I can create canvases in an external..
but my question was about what I can do with pointer methods in an external.

Is there an example that uses the public API to discover information from a
pointer? To traverse it and extract data? Augment data? Add data?
How about the pointer outlet capabilities for externals.. is there any
point at this time? It looks like the public API has what an author would
need to create an 'owned' pointer (gpointer_init) and then output it, but
does the public API provide any way to actually associate anything useful
with it?


On Fri, Jan 3, 2020 at 1:34 PM Christof Ressi <christof.ressi at gmx.at> wrote:

> Hi,
> if you consider writing an external, why not include the data? Having the
> data model in Pd data structures and writing an external just to access it
> is certainly possible, but IMO doesn't make much sense.
> In your external you can create a (hidden) canvas and add garrays, either
> with graph_array() from g_array.c or or by sending the "array" message to
> the canvas with pd_typedmess(). DSP objects like [tabwrite4~] can then
> access those garrays by their name.
> This is how you create a hidden canvas:
> https://git.iem.at/pd/vstplugin/blob/master/pd/src/vstplugin~.cpp#L728
> And this is how you add objects:
> https://git.iem.at/pd/vstplugin/blob/master/pd/src/vstplugin~.cpp#L868
> NOTE: I wouldn't really recommend this
> ---
> The other possibility is to have your data model in an abstraction, with
> the float arrays in [table] or [array define], and then use [clone] or
> dynamic patching. I think this is less work :-)
> ---
> That being said, I think there should be a way for [tabwrite~] etc. to
> access data structure "float" arrays. See also:
> https://github.com/pure-data/pure-data/pull/667
> Christof
> *Gesendet:* Freitag, 03. Januar 2020 um 17:59 Uhr
> *Von:* "x nor" <x37v.alex at gmail.com>
> *An:* pd-dev <pd-dev at lists.iem.at>
> *Betreff:* [PD-dev] capabilities of data structures with externals
> This past week I've finally learned a bit more about data structures in PD
> and I've successfully created my own data structures that model data from
> ATS files (sines + noise analysis models).
> The re-synthesis ended up being a bit heavy because I didn't see a way to
> use tabread~/tabread4~ directly with arrays of complex data, so I patched
> some helpers that iterate the data structures and create float arrays from
> the fields as needed.
> I'm wondering if I can replace this with an external that deals with these
> details internally so I have a few questions before I go down that road:
> 1) I see that I can register "pointer" methods for externals.. my
> structure has a field that stores an array that stores arrays of structs,
> can I expect to be able to get to that data in an external? Any examples?
> 2) If I am able to get to the data, can I mark it as 'used for dsp'
> somehow like i see you can do for garrays, and then use it within a dsp
> callback 'safely' or do i need to copy the data into separate float arrays
> to do that?.. maybe i should reorganize the data so that I don't have to do
> the copy, but if I end up creating a bunch of float arrays to model the
> data inside my data structure, can I then somehow treat it as a "garray"
> and mark it used in dsp and use it in my dsp method?
> Thanks,
> Alex
> _______________________________________________ Pd-dev mailing list
> Pd-dev at lists.iem.at https://lists.puredata.info/listinfo/pd-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20200104/13ea169f/attachment-0001.html>

More information about the Pd-dev mailing list