[PD] reading arrays from an external

IOhannes m zmoelnig zmoelnig at iem.at
Mon Sep 21 16:41:37 CEST 2015


On 2015-09-21 16:24, oscar pablo di liscia wrote:
> Many thanks.
> So that, if a table is not used in a dsp process, and we
> don't use the garray_usedindsp() function,  it is safe to change
> its contents providing the fact that this change is properly
> done using the access methods available?


really there is only a single access method (to the data) available:
garray_getfloatwords() returns a pointer to an array of words which you
can dereference to read or write the actual values.


it's always safe to *immediately* use the data returned by
garray_getfloatwords().

however, if you want - for performance reasons - to cache the returned
pointer, then you need some wy of invalidating it (e.g. because the
table the pointer referred to has moved to some other place).
that's the use case of garray_usedindsp().

it builds on the assumption that only DSP objects would use this kind of
optimization.
as a result, you *can* only use this optimization in DSP perform
routines. all other table access has to be done through
garray_getfloatwords() immediately before dereferencing the pointer.



if you must change the size of a table, use garray_resize_long();
after that you must call garray_usedindsp() again to get the new data
pointer.

hopefully this makes it a bit clearer.

fgmasdr
IOhannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150921/f60d6822/attachment.sig>


More information about the Pd-list mailing list