[PD] reading arrays from an external

IOhannes m zmoelnig zmoelnig at iem.at
Mon Sep 21 09:27:58 CEST 2015


On 2015-09-21 00:22, oscar pablo di liscia wrote:
> Hi list.
> I have a question on allocating data and reading it through an external.
> As I have seen so far, the externals that reads arrays, as tabread, allocate
> the data in their own memory space. As far as I can understand, this result
> in a "double allocation" of the data. One in the array itself and the other
> one in the
> internal memory space of the instance of the tabread external.
> The point is that I would like to use an array to hold in memory a
> considerable
> amount of data and to make it available to an arbitrary "reader" objects
> without the need of allocating the data again in each one of the readers.
> Is it possible to write an external that that reads data from an array "on
> the fly"
> without the need of allocating the data in its own memory space?
> Any help will be most appreciate.

virtually all¹ objects accessing table data reference the data
"directly" using the "garray_getfloatwords()" function to get a pointer
where the array stores its data.
this does not involve any double allocation at all.
it is also the only sane way to always use up-to-date data: if the user
modifies the data via [tabwrite] or whatever, there is no way to signal
the table consumers that the table data has changed (so that they can
copy the relevant new data into their local copy), so the consumer must
use the changed data directly.

which objects have you found that proxy the data?

gfasd,rt
IOhannes



¹ i seem to remember that [partconv~] does copy the data during
DSP-graph recompilation, mainly because it does some heavy processing on
the data (FFTs and what not), which it doesn't want to do for each
signal block. i might be mistaken though.



More information about the Pd-list mailing list