Each time I code an external, I am facing a very basic question for which I never found a clean answer: how to properly set default values of the attributes in the new methods with custom setters?
For instance, if the new() method looks like the one in the API doc, i.e.:
void *myobject_new(t_symbol *s, long ac, t_atom *av)
t_myobject *x = NULL;
if (x=(t_myobject *)object_alloc(myobject_class))
// initialize any data before processing
// attributes to avoid overwriting
// attribute argument-set values
x->data = 0;
// process attr args, if any
attr_args_process(x, ac, av);
This is ok as long as the attribute "data" does not have a custom setter. But if it has, then as far as I know, the setter is not being called at all in this method.
So my question: how to define default attribute values in the new() methods and be sure that all setters are called?