I've written an MSP external object with a fairly intensive initialization process that involves dynamically allocated memory. I've hard-coded parameters while I was getting everything working that now need to be user-configurable while the patch is running. Unfortunately all of the initialization is taking place in the *obj_new() function at the moment, which I just realized is a bad idea for my purposes.
I am thinking that making use of attributes is the friendliest option for parameter setting because I plan on having users make use of the Runtime and not full Max.
What is the best way to proceed?
My thought so far is to put a (memory free/re-initialization) function into the obj_dsp64() function right before I add the obj_perform64() function to the signal chain. I would overload the attribute accessor functions to require a memfree/re-init if they were changed by flipping an "attribute changed" bool. If there is some initial loading time on start each time attributes are changed I don't mind.
My question is... does this sound completely idiotic? Is it memory/thread safe? Is there a better way that I should attempt?
I read a lot of great answers to other questions I had on this board... hoping someone stops me from doing something stupid :P