Very clear, many thanks.

Oscar Pablo Di Liscia

2015-09-21 11:41 GMT-03:00 IOhannes m zmoelnig <zmoelnig@iem.at>:
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


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list