CLASS_ATTR_ATOM_VARSIZE with large arrays

Aug 22, 2012 at 1:40pm

CLASS_ATTR_ATOM_VARSIZE with large arrays

So, I assumed I could use CLASS_ATTR_ATOM_VARSIZE on a dynamically allocated array of atoms (so I have only a pointer to the atom array in my struct), but it appears that this call assumes that the array is a real array within the struct….

What is the best way around this problem – is it simply a case of writing my of getter (I already have a custom setter which I assume works correctly), or is there a better way to go about this?

If I am writing my own custom getters and setters can I somehow use a t_atomarray to get a dynamic array with all those cool features?

FWIW I do not want to limit the size of the atom array to be too small, so I cannot have a real array in my struct….

Thanks

Alex

#64050
Aug 22, 2012 at 2:35pm

Hi,

(Sorry not a response to your question but…)

Last time i wanted to use a very large array as attribute i finally abort as i found easier to “save data with patcher” : http://cycling74.com/forums/topic.php?id=26727

#231021
Aug 22, 2012 at 3:47pm

Hi Nicolas – thanks for that – unfortunately this is not appropriate in my case as I really do need it to be an attribute – most of the time the arrays will be small – but the option needs to be there for a much longer array. Thanks also for your previous reply which links to a thread with all the answers I needed!

Anyway, I’ve just written a custom getter and it seems happy – it’s just that the custom getter (and presumably setter) assume a real array….. So, I seem to be sorted. I’d be interested to know if I actually have to have a maximum array size in this scenario, as I’m allocate the array for the getter, but a fixed maximum size is fine for me right now.

Alex

#231022
Aug 22, 2012 at 5:17pm
#231023
Aug 22, 2012 at 5:20pm

I hadn’t but this pretty much confirms what I have discovered. Anyway – good to have it official and have a link to something for anyone following this thread….

Thanks

A.

#231024

You must be logged in to reply to this topic.