Max 5 API Reference

Attributes

An attribute of an object is a setting or property that tells the object how to do its job. More...

Data Structures

struct  t_attr
 Common attr struct. More...

Defines

#define CLASS_ATTR_CHAR(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(char),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a char attribute and add it to a Max class.
#define CLASS_ATTR_LONG(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(long),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a long integer attribute and add it to a Max class.
#define CLASS_ATTR_FLOAT(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(float32),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a 32-bit float attribute and add it to a Max class.
#define CLASS_ATTR_DOUBLE(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(float64),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a 64-bit float attribute and add it to a Max class.
#define CLASS_ATTR_SYM(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(symbol),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a t_symbol* attribute and add it to a Max class.
#define CLASS_ATTR_ATOM(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(atom),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a t_atom attribute and add it to a Max class.
#define CLASS_ATTR_OBJ(c, attrname, flags, structname, structmember)   class_addattr((c),attr_offset_new(attrname,USESYM(object),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))
 Create a t_object* attribute and add it to a Max class.
#define CLASS_ATTR_CHAR_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(char),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-chars attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_LONG_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(long),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-long-integers attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_FLOAT_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(float32),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-32bit-floats attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_DOUBLE_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(float64),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-64bit-floats attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_SYM_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(symbol),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-symbols attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_ATOM_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(atom),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-atoms attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_OBJ_ARRAY(c, attrname, flags, structname, structmember, size)   class_addattr((c),attr_offset_array_new(attrname,USESYM(object),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))
 Create an array-of-objects attribute of fixed length, and add it to a Max class.
#define CLASS_ATTR_CHAR_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(char),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-chars attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_LONG_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(long),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-long-integers attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_FLOAT_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(float32),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-32bit-floats attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_DOUBLE_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(float64),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-64bit-floats attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_SYM_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(symbol),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-symbols attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_ATOM_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(atom),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-atoms attribute of variable length, and add it to a Max class.
#define CLASS_ATTR_OBJ_VARSIZE(c, attrname, flags, structname, structmember, sizemember, maxsize)   class_addattr((c),attr_offset_array_new(attrname,USESYM(object),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))
 Create an array-of-objects attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_CHAR(c, flags, structname, structmember)   CLASS_ATTR_CHAR(c,#structmember,flags,structname,structmember)
 Create a char attribute and add it to a Max class.
#define STRUCT_ATTR_LONG(c, flags, structname, structmember)   CLASS_ATTR_LONG(c,#structmember,flags,structname,structmember)
 Create a long integer attribute and add it to a Max class.
#define STRUCT_ATTR_FLOAT(c, flags, structname, structmember)   CLASS_ATTR_FLOAT(c,#structmember,flags,structname,structmember)
 Create a 32bit float attribute and add it to a Max class.
#define STRUCT_ATTR_DOUBLE(c, flags, structname, structmember)   CLASS_ATTR_DOUBLE(c,#structmember,flags,structname,structmember)
 Create a 64bit float attribute and add it to a Max class.
#define STRUCT_ATTR_SYM(c, flags, structname, structmember)   CLASS_ATTR_SYM(c,#structmember,flags,structname,structmember)
 Create a t_symbol* attribute and add it to a Max class.
#define STRUCT_ATTR_ATOM(c, flags, structname, structmember)   CLASS_ATTR_ATOM(c,#structmember,flags,structname,structmember)
 Create a t_atom attribute and add it to a Max class.
#define STRUCT_ATTR_OBJ(c, flags, structname, structmember)   CLASS_ATTR_OBJ(c,#structmember,flags,structname,structmember)
 Create a t_object* attribute and add it to a Max class.
#define STRUCT_ATTR_CHAR_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_CHAR_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-chars attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_LONG_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_LONG_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-long-integers attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_FLOAT_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_FLOAT_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-32bit-floats attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_DOUBLE_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_DOUBLE_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-64bit-floats attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_SYM_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_SYM_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-symbols attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_ATOM_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_ATOM_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-atoms attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_OBJ_ARRAY(c, flags, structname, structmember, size)   CLASS_ATTR_OBJ_ARRAY(c,#structmember,flags,structname,structmember,size)
 Create an array-of-objects attribute of fixed length, and add it to a Max class.
#define STRUCT_ATTR_CHAR_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_CHAR_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-chars attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_LONG_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_LONG_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-long-integers attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_FLOAT_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_FLOAT_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-32bit-floats attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_DOUBLE_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_DOUBLE_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-64bit-floats attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_SYM_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_SYM_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-symbols attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_ATOM_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_ATOM_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-atoms attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_OBJ_VARSIZE(c, flags, structname, structmember, sizemember, maxsize)   CLASS_ATTR_OBJ_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)
 Create an array-of-objects attribute of variable length, and add it to a Max class.
#define STATIC_ATTR_CHAR(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(char),flags,"c",val)
 Create a shared (static/global) char attribute and add it to a Max class.
#define STATIC_ATTR_LONG(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(long),flags,"l",val)
 Create a shared (static/global) long integer attribute and add it to a Max class.
#define STATIC_ATTR_FLOAT(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(float32),flags,"f",val)
 Create a shared (static/global) 32bit float attribute and add it to a Max class.
#define STATIC_ATTR_DOUBLE(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(float64),flags,"d",val)
 Create a shared (static/global) 64bit float attribute and add it to a Max class.
#define STATIC_ATTR_SYM(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(symbol),flags,"s",val)
 Create a shared (static/global) t_symbol* attribute and add it to a Max class.
#define STATIC_ATTR_ATOM(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(atom),flags,"a",val)
 Create a shared (static/global) t_atom attribute and add it to a Max class.
#define STATIC_ATTR_OBJ(c, attrname, flags, val)   STATIC_ATTR_FORMAT(c,attrname,USESYM(object),flags,"o",val)
 Create a shared (static/global) t_object* attribute and add it to a Max class.
#define STATIC_ATTR_CHAR_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(char),flags,"C",count,vals)
 Create a shared (static/global) array-of-chars attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_LONG_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(long),flags,"L",count,vals)
 Create a shared (static/global) array-of-long-integers attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_FLOAT_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(float32),flags,"F",count,vals)
 Create a shared (static/global) array-of-32bit-floats attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_DOUBLE_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(float64),flags,"D",count,vals)
 Create a shared (static/global) array-of-64bit-floats attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_SYM_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(symbol),flags,"S",count,vals)
 Create a shared (static/global) array-of-symbols attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_ATOM_ARRAY   STATIC_ATTR_ATOMS
 Create a shared (static/global) array-of-atoms attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_OBJ_ARRAY(c, attrname, flags, count, vals)   STATIC_ATTR_FORMAT(c,attrname,USESYM(object),flags,"O",count,vals)
 Create a shared (static/global) array-of-objects attribute of fixed length, and add it to a Max class.
#define OBJ_ATTR_CHAR(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(char),flags,"c",val)
 Create an instance-local char attribute and add it to a Max class.
#define OBJ_ATTR_LONG(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(long),flags,"l",val)
 Create an instance-local long integer attribute and add it to a Max class.
#define OBJ_ATTR_FLOAT(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(float32),flags,"f",val)
 Create an instance-local 32bit float attribute and add it to a Max class.
#define OBJ_ATTR_DOUBLE(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(float64),flags,"d",val)
 Create an instance-local 64bit float attribute and add it to a Max class.
#define OBJ_ATTR_SYM(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(symbol),flags,"s",val)
 Create an instance-local t_symbol* attribute and add it to a Max class.
#define OBJ_ATTR_ATOM(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(atom),flags,"a",val)
 Create an instance-local t_atom attribute and add it to a Max class.
#define OBJ_ATTR_OBJ(x, attrname, flags, val)   OBJ_ATTR_FORMAT(x,attrname,USESYM(object),flags,"o",val)
 Create an instance-local t_object* attribute and add it to a Max class.
#define OBJ_ATTR_CHAR_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(char),flags,"C",count,vals)
 Create an instance-local array-of-chars attribute of fixed length, and add it to the object.
#define OBJ_ATTR_LONG_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(long),flags,"L",count,vals)
 Create an instance-local array-of-long-integers attribute of fixed length, and add it to the object.
#define OBJ_ATTR_FLOAT_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(float32),flags,"F",count,vals)
 Create an instance-local array-of-32bit-floats attribute of fixed length, and add it to the object.
#define OBJ_ATTR_DOUBLE_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(float64),flags,"D",count,vals)
 Create an instance-local array-of-64bit-floats attribute of fixed length, and add it to the object.
#define OBJ_ATTR_SYM_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(symbol),flags,"S",count,vals)
 Create an instance-local array-of-symbols attribute of fixed length, and add it to the object.
#define OBJ_ATTR_ATOM_ARRAY   OBJ_ATTR_ATOMS
 Create an instance-local array-of-atoms attribute of fixed length, and add it to the object.
#define OBJ_ATTR_OBJ_ARRAY(x, attrname, flags, count, vals)   OBJ_ATTR_FORMAT(x,attrname,USESYM(object),flags,"O",count,vals)
 Create an instance-local array-of-objects attribute of fixed length, and add it to the object.
#define CLASS_ATTR_ACCESSORS(c, attrname, getter, setter)
 Specify custom accessor methods for an attribute.
#define CLASS_ATTR_ADD_FLAGS(c, attrname, flags)
 Add flags to an attribute.
#define CLASS_ATTR_REMOVE_FLAGS(c, attrname, flags)
 Remove flags from an attribute.
#define CLASS_ATTR_FILTER_MIN(c, attrname, minval)
 Add a filter to the attribute to limit the lower bound of a value.
#define CLASS_ATTR_FILTER_MAX(c, attrname, maxval)
 Add a filter to the attribute to limit the upper bound of a value.
#define CLASS_ATTR_FILTER_CLIP(c, attrname, minval, maxval)
 Add a filter to the attribute to limit both the lower and upper bounds of a value.
#define CLASS_ATTR_ALIAS(c, attrname, aliasname)
 Create a new attribute that is an alias of an existing attribute.
#define CLASS_ATTR_DEFAULT(c, attrname, flags, parsestr)   { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"default",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }
 Add a new attribute to the specified attribute to specify a default value.
#define CLASS_ATTR_SAVE(c, attrname, flags)   CLASS_ATTR_ATTR_PARSE(c,attrname,"save",USESYM(long),flags,"1")
 Add a new attribute to the specified attribute to indicate that the specified attribute should be saved with the patcher.
#define CLASS_ATTR_DEFAULT_SAVE(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); }
 A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_SAVE.
#define CLASS_ATTR_DEFAULTNAME(c, attrname, flags, parsestr)   { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"defaultname",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }
 Add a new attribute to the specified attribute to specify a default value, based on Max's Object Defaults.
#define CLASS_ATTR_DEFAULTNAME_SAVE(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); }
 A convenience wrapper for both CLASS_ATTR_DEFAULTNAME and CLASS_ATTR_SAVE.
#define CLASS_ATTR_MIN(c, attrname, flags, parsestr)   { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"min",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }
 Add a new attribute to the specified attribute to specify a lower range.
#define CLASS_ATTR_MAX(c, attrname, flags, parsestr)   { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"max",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }
 Add a new attribute to the specified attribute to specify an upper range.
#define CLASS_ATTR_PAINT(c, attrname, flags)   CLASS_ATTR_ATTR_PARSE(c,attrname,"paint",USESYM(long),flags,"1")
 Add a new attribute indicating that any changes to the specified attribute will trigger a call to the object's paint method.
#define CLASS_ATTR_DEFAULT_PAINT(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_PAINT(c,attrname,flags); }
 A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULT_SAVE_PAINT(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }
 A convenience wrapper for CLASS_ATTR_DEFAULT, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULTNAME_PAINT(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_PAINT(c,attrname,flags); }
 A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c, attrname, flags, parsestr)   { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }
 A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_STYLE(c, attrname, flags, parsestr)   CLASS_ATTR_ATTR_PARSE(c,attrname,"style",USESYM(symbol),flags,parsestr)
 Add a new attribute to the specified attribute to specify an editor style for the Max inspector.
#define CLASS_ATTR_LABEL(c, attrname, flags, labelstr)   CLASS_ATTR_ATTR_FORMAT(c,attrname,"label",USESYM(symbol),flags,"s",gensym(labelstr))
 Add a new attribute to the specified attribute to specify an a human-friendly label for the Max inspector.
#define CLASS_ATTR_ENUM(c, attrname, flags, parsestr)   { CLASS_ATTR_STYLE(c,attrname,flags,"enum"); CLASS_ATTR_ATTR_PARSE(c,attrname,"enumvals",USESYM(atom),flags,parsestr); }
 Add a new attribute to the specified attribute to specify a list of choices to display in a menu for the Max inspector.
#define CLASS_ATTR_ENUMINDEX(c, attrname, flags, parsestr)   { CLASS_ATTR_STYLE(c,attrname,flags,"enumindex"); CLASS_ATTR_ATTR_PARSE(c,attrname,"enumvals",USESYM(atom),flags,parsestr); }
 Add a new attribute to the specified attribute to specify a list of choices to display in a menu for the Max inspector.
#define CLASS_ATTR_CATEGORY(c, attrname, flags, parsestr)   CLASS_ATTR_ATTR_PARSE(c,attrname,"category",USESYM(symbol),flags,parsestr)
 Add a new attribute to the specified attribute to specify a category to which the attribute is assigned in the Max inspector.
#define CLASS_ATTR_STYLE_LABEL(c, attrname, flags, stylestr, labelstr)   { CLASS_ATTR_ATTR_PARSE(c,attrname,"style",USESYM(symbol),flags,stylestr); CLASS_ATTR_ATTR_FORMAT(c,attrname,"label",USESYM(symbol),flags,"s",gensym(labelstr)); }
 A convenience wrapper for CLASS_ATTR_STYLE, and CLASS_ATTR_LABEL.
#define CLASS_ATTR_INVISIBLE(c, attrname, flags)   CLASS_ATTR_ATTR_PARSE(c,attrname,"invisible",USESYM(long),flags,"1")
 Add a new attribute to the specified attribute to flag an attribute as invisible to the Max inspector.
#define CLASS_ATTR_ORDER(c, attrname, flags, parsestr)   CLASS_ATTR_ATTR_PARSE(c,attrname,"order",USESYM(long),flags,parsestr)
 Add a new attribute to the specified attribute to specify a default order in which to list attributes.
#define CLASS_METHOD_ATTR_PARSE(c, methodname, attrname, type, flags, parsestring)
 Define and add attributes to class methods.
#define OBJ_ATTR_DEFAULT(x, attrname, flags, parsestr)   { t_object *theattr=(t_object *)object_attr_get(x,gensym(attrname)); OBJ_ATTR_ATTR_PARSE(x,attrname,"default",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }
 An instance-attribute version of CLASS_ATTR_DEFAULT.
#define OBJ_ATTR_SAVE(x, attrname, flags)   OBJ_ATTR_ATTR_PARSE(x,attrname,"save",USESYM(long),flags,"1")
 An instance-attribute version of CLASS_ATTR_SAVE.
#define OBJ_ATTR_DEFAULT_SAVE(x, attrname, flags, parsestr)   { OBJ_ATTR_DEFAULT(x,attrname,flags,parsestr); OBJ_ATTR_SAVE(x,attrname,flags); }
 An instance-attribute version of CLASS_ATTR_DEFAULT_SAVE.
#define CLASS_STICKY_ATTR(c, name, flags, parsestr)   { t_object *attr = attribute_new_parse(name,NULL,flags,parsestr); class_sticky(c,gensym("sticky_attr"),gensym(name),attr); }
 Create an attribute, and add it to all following attribute declarations.
#define CLASS_STICKY_ATTR_CLEAR(c, name)   class_sticky_clear(c,gensym("sticky_attr"),name?gensym(name):NULL)
 Close a CLASS_STICKY_ATTR block.
#define CLASS_STICKY_METHOD(c, name, flags, parsestr)   { t_object *attr = attribute_new_parse(name,NULL,flags,parsestr); class_sticky(c,gensym("sticky_method"),gensym(name),attr); }
 Create an attribute, and add it to all following method declarations.
#define CLASS_STICKY_METHOD_CLEAR(c, name)   class_sticky_clear(c,gensym("sticky_method"),name?gensym(name):clear)
 Close a CLASS_STICKY_METHOD block.
#define CLASS_ATTR_RGBA(c, attrname, flags, structname, structmember)
 Create a color (t_jrgba) attribute and add it to a Max class.

Enumerations

enum  e_max_attrflags {
  ATTR_FLAGS_NONE = 0x0000000,
  ATTR_GET_OPAQUE = 0x00000001,
  ATTR_SET_OPAQUE = 0x00000002,
  ATTR_GET_OPAQUE_USER = 0x00000100,
  ATTR_SET_OPAQUE_USER = 0x00000200
}
 

Attribute flags.

More...

Functions

void * object_attr_get (void *x, t_symbol *attrname)
 Returns the pointer to an attribute, given its name.
method object_attr_method (void *x, t_symbol *methodname, void **attr, long *get)
 Returns the method of an attribute's get or set function, as well as a pointer to the attribute itself, from a message name.
long object_attr_usercanset (void *x, t_symbol *s)
 Determines if an object's attribute can be set from the Max interface (i.e.
long object_attr_usercanget (void *x, t_symbol *s)
 Determines if the value of an object's attribute can be queried from the Max interface (i.e.
void object_attr_getdump (void *x, t_symbol *s, long argc, t_atom *argv)
 Forces a specified object's attribute to send its value from the object's dumpout outlet in the Max interface.
t_max_err object_attr_setvalueof (void *x, t_symbol *s, long argc, t_atom *argv)
 Sets the value of an object's attribute.
t_max_err object_addattr (void *x, t_object *attr)
 Attaches an attribute directly to an object.
t_max_err object_deleteattr (void *x, t_symbol *attrsym)
 Detach an attribute from an object that was previously attached with object_addattr().
t_max_err object_chuckattr (void *x, t_symbol *attrsym)
 Detach an attribute from an object that was previously attached with object_addattr().
long attr_args_offset (short ac, t_atom *av)
 Determines the point in an atom list where attribute arguments begin.
void attr_args_process (void *x, short ac, t_atom *av)
 Takes an atom list and properly set any attributes described within.
t_objectattribute_new (C74_CONST char *name, t_symbol *type, long flags, method mget, method mset)
 Create a new attribute.
t_objectattr_offset_new (C74_CONST char *name, C74_CONST t_symbol *type, long flags, C74_CONST method mget, C74_CONST method mset, long offset)
 Create a new attribute.
t_objectattr_offset_array_new (C74_CONST char *name, t_symbol *type, long size, long flags, method mget, method mset, long offsetcount, long offset)
 Create a new attribute.
long object_attr_getlong (void *x, t_symbol *s)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setlong (void *x, t_symbol *s, long c)
 Sets the value of an attribute, given its parent object and name.
float object_attr_getfloat (void *x, t_symbol *s)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setfloat (void *x, t_symbol *s, float c)
 Sets the value of an attribute, given its parent object and name.
t_symbolobject_attr_getsym (void *x, t_symbol *s)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setsym (void *x, t_symbol *s, t_symbol *c)
 Sets the value of an attribute, given its parent object and name.
long object_attr_getlong_array (void *x, t_symbol *s, long max, long *vals)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setlong_array (void *x, t_symbol *s, long count, long *vals)
 Sets the value of an attribute, given its parent object and name.
long object_attr_getchar_array (void *x, t_symbol *s, long max, uchar *vals)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setchar_array (void *x, t_symbol *s, long count, C74_CONST uchar *vals)
 Sets the value of an attribute, given its parent object and name.
long object_attr_getfloat_array (void *x, t_symbol *s, long max, float *vals)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setfloat_array (void *x, t_symbol *s, long count, float *vals)
 Sets the value of an attribute, given its parent object and name.
long object_attr_getdouble_array (void *x, t_symbol *s, long max, double *vals)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setdouble_array (void *x, t_symbol *s, long count, double *vals)
 Sets the value of an attribute, given its parent object and name.
long object_attr_getsym_array (void *x, t_symbol *s, long max, t_symbol **vals)
 Retrieves the value of an attribute, given its parent object and name.
t_max_err object_attr_setsym_array (void *x, t_symbol *s, long count, t_symbol **vals)
 Sets the value of an attribute, given its parent object and name.
t_max_err attr_addfilterset_clip (void *x, double min, double max, long usemin, long usemax)
 Attaches a clip filter to an attribute.
t_max_err attr_addfilterset_clip_scale (void *x, double scale, double min, double max, long usemin, long usemax)
 Attaches a clip/scale filter to an attribute.
t_max_err attr_addfilterget_clip (void *x, double min, double max, long usemin, long usemax)
 Attaches a clip filter to an attribute.
t_max_err attr_addfilterget_clip_scale (void *x, double scale, double min, double max, long usemin, long usemax)
 Attaches a clip/scale filter to an attribute.
t_max_err attr_addfilter_clip (void *x, double min, double max, long usemin, long usemax)
 Attaches a clip filter to an attribute.
t_max_err attr_addfilter_clip_scale (void *x, double scale, double min, double max, long usemin, long usemax)
 Attaches a clip/scale filter to an attribute.
t_max_err attr_addfilterset_proc (void *x, method proc)
 Attaches a custom filter method to an attribute.
t_max_err attr_addfilterget_proc (void *x, method proc)
 Attaches a custom filter method to an attribute.
void attr_args_dictionary (t_dictionary *x, short ac, t_atom *av)
 Create a dictionary of attribute-name, attribute-value pairs from an array of atoms containing an attribute definition list.
void attr_dictionary_process (void *x, t_dictionary *d)
 Set attributes for an object that are defined in a dictionary.
t_max_err object_attr_setparse (t_object *x, t_symbol *s, C74_CONST char *parsestr)
 Set an attribute value with one or more atoms parsed from a C-string.
void * object_new_parse (t_symbol *name_space, t_symbol *classname, C74_CONST char *parsestr)
 Create a new object with one or more atoms parsed from a C-string.
t_max_err object_attr_getjrgba (void *ob, t_symbol *s, t_jrgba *c)
 Retrieves the value of a color attribute, given its parent object and name.
t_max_err object_attr_setjrgba (void *ob, t_symbol *s, t_jrgba *c)
 Sets the value of a color attribute, given its parent object and name.
t_max_err object_attr_get_rect (t_object *o, t_symbol *name, t_rect *rect)
 Gets the value of a t_rect attribute, given its parent object and name.
t_max_err object_attr_set_rect (t_object *o, t_symbol *name, t_rect *rect)
 Sets the value of a t_rect attribute, given its parent object and name.
t_max_err object_attr_getpt (t_object *o, t_symbol *name, t_pt *pt)
 Gets the value of a t_pt attribute, given its parent object and name.
t_max_err object_attr_setpt (t_object *o, t_symbol *name, t_pt *pt)
 Sets the value of a t_pt attribute, given its parent object and name.
t_max_err object_attr_getsize (t_object *o, t_symbol *name, t_size *size)
 Gets the value of a t_size attribute, given its parent object and name.
t_max_err object_attr_setsize (t_object *o, t_symbol *name, t_size *size)
 Sets the value of a t_size attribute, given its parent object and name.
t_max_err object_attr_getcolor (t_object *b, t_symbol *attrname, t_jrgba *prgba)
 Gets the value of a t_jrgba attribute, given its parent object and name.
t_max_err object_attr_setcolor (t_object *b, t_symbol *attrname, t_jrgba *prgba)
 Sets the value of a t_jrgba attribute, given its parent object and name.

Detailed Description

An attribute of an object is a setting or property that tells the object how to do its job.

For example, the metro object has an interval attribute that tells it how fast to run.

Attributes are similar to methods, except that the attributes have a state. Attributes are themselves objects, and they share a common interface for getting and setting values.

An attribute is most typically added to the class definition of another object during it's class initialization or main() function. Most typically, this attribute's value will be stored in an instance's struct, and thus it will serve as a property of that instance of the object.

Attributes can, however, be declared as 'class static'. This means that the property is shared by all instances of the class, and the value is stored as a shared (static) variable.

Additionally, Max 5 has introduced the notion of 'instance attributes' (also called 'object attributes'). Instance attributes are the creation of an attribute object, and then adding it to one specific instance of another class.

Finally, because attributes themselves are Max objects they too can possess attributes. These 'attributes of attributes' are used in Max to do things like specify a range of values for an attribute, give an attribute human friendly caption, or determine to what category an attribute should belong in the inspector.

The easiest and most common way of working with attributes is to use the provided macros. These macros simplify the process of creating a new attribute object, setting any attributes of the attribute, and binding it to an object class or an object instance.

Setting and Getting Attribute Values

By default, Max provides standard attribute accessors. These are the functions the get or set the attribute value in the object's struct. If you need to define a custom accessor, you can specify this information using the CLASS_ATTR_ACCESSORS macro.

Writing a custom Attribute Getter

If you need to define a custom accessor, it should have a prototype and form comparable to the following custom getter:

   t_max_err foo_myval_get(t_foo *x, void *attr, long *ac, t_atom **av) 
   {
      if ((*ac)&&(*av)) {
         //memory passed in, use it
      } else {
         //otherwise allocate memory
         *ac = 1;
         if (!(*av = getbytes(sizeof(t_atom)*(*ac)))) {
            *ac = 0;
            return MAX_ERR_OUT_OF_MEM;
         }
      }
      atom_setfloat(*av,x->myval);

      return MAX_ERR_NONE;
   }

Note that getters require memory to be allocated, if there is not memory passed into the getter. Also the attr argument is the class' attribute object and can be queried using object_method for things like the attribute flags, names, filters, etc..

Writing a custom Attribute Getter

If you need to define a custom accessor, it should have a prototype and form comparable to the following custom setter:

   t_max_err foo_myval_set(t_foo *x, void *attr, long ac, t_atom *av) 
   {
      if (ac&&av) {
         x->myval = atom_getfloat(av);
      } else {
         // no args, set to zero
         x->myval = 0;
      }
      return MAX_ERR_NONE;
   }

Attribute Notificaton

Although the subject of object registration and notification is covered elsewhere, it bears noting that attributes of all types will, if registered, automatically send notifications to all attached client objects each time the attribute's value is set.


Define Documentation

#define CLASS_ATTR_ACCESSORS ( c,
attrname,
getter,
setter   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      object_method(theattr,gensym("setmethod"),USESYM(get),getter); \
      object_method(theattr,gensym("setmethod"),USESYM(set),setter); }

Specify custom accessor methods for an attribute.

If you specify a non-NULL value for the setter or getter, then the function you specify will be called to set or get the attribute's value rather than using the built-in accessor.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
getter An appropriate getter method as discussed in Setting and Getting Attribute Values, or NULL to use the default getter.
setter An appropriate setter method as discussed in Setting and Getting Attribute Values, or NULL to use the default setter.
#define CLASS_ATTR_ADD_FLAGS ( c,
attrname,
flags   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      long oldflags = object_method(theattr,gensym("getflags")); \
      object_method(theattr,gensym("setflags"),oldflags|(flags)); }

Add flags to an attribute.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to add to this attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_ALIAS ( c,
attrname,
aliasname   ) 
Value:
{  t_object *thealias; \
      t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      thealias = object_clone(theattr); \
      object_method(thealias,USESYM(setname),gensym(aliasname)); \
      class_addattr(c,thealias); \
      CLASS_ATTR_ATTR_PARSE(c,aliasname,"alias",USESYM(symbol),0,attrname); }

Create a new attribute that is an alias of an existing attribute.

Parameters:
c The class pointer.
attrname The name of the actual attribute as a C-string.
aliasname The name of the new alias attribute.
#define CLASS_ATTR_ATOM ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(atom),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a t_atom attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_ATOM_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(atom),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-atoms attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_atom array.
#define CLASS_ATTR_ATOM_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(atom),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-atoms attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_atom array at any given moment.
maxsize The maximum number of items in the t_atom array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_CATEGORY ( c,
attrname,
flags,
parsestr   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"category",USESYM(symbol),flags,parsestr)

Add a new attribute to the specified attribute to specify a category to which the attribute is assigned in the Max inspector.

Categories are represented in the inspector as tabs. If the specified category does not exist then it will be created.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
#define CLASS_ATTR_CHAR ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(char),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a char attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_CHAR_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(char),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-chars attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of chars in the array.
#define CLASS_ATTR_CHAR_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(char),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-chars attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the char array at any given moment.
maxsize The maximum number of items in the char array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_DEFAULT ( c,
attrname,
flags,
parsestr   )     { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"default",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }

Add a new attribute to the specified attribute to specify a default value.

The default value will be automatically set when the object is created only if your object uses a dictionary constructor with the CLASS_FLAG_NEWDICTIONARY flag.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
#define CLASS_ATTR_DEFAULT_PAINT ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_PAINT(c,attrname,flags); }

A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_PAINT.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULT
CLASS_ATTR_PAINT
#define CLASS_ATTR_DEFAULT_SAVE ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); }

A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_SAVE.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULT
CLASS_ATTR_SAVE
#define CLASS_ATTR_DEFAULT_SAVE_PAINT ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }

A convenience wrapper for CLASS_ATTR_DEFAULT, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULT
CLASS_ATTR_PAINT
CLASS_ATTR_SAVE
#define CLASS_ATTR_DEFAULTNAME ( c,
attrname,
flags,
parsestr   )     { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"defaultname",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }

Add a new attribute to the specified attribute to specify a default value, based on Max's Object Defaults.

If a value is present in Max's Object Defaults, then that value will be used as the default value. Otherwise, use the default value specified here. The default value will be automatically set when the object is created only if your object uses a dictionary constructor with the CLASS_FLAG_NEWDICTIONARY flag.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
#define CLASS_ATTR_DEFAULTNAME_PAINT ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_PAINT(c,attrname,flags); }

A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULTNAME
CLASS_ATTR_PAINT
CLASS_ATTR_SAVE
#define CLASS_ATTR_DEFAULTNAME_SAVE ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); }

A convenience wrapper for both CLASS_ATTR_DEFAULTNAME and CLASS_ATTR_SAVE.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULTNAME
CLASS_ATTR_SAVE
#define CLASS_ATTR_DEFAULTNAME_SAVE_PAINT ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_DEFAULTNAME(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }

A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULTNAME
CLASS_ATTR_PAINT
CLASS_ATTR_SAVE
#define CLASS_ATTR_DOUBLE ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(float64),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a 64-bit float attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_DOUBLE_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(float64),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-64bit-floats attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of doubles in the array.
#define CLASS_ATTR_DOUBLE_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(float64),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-64bit-floats attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the double array at any given moment.
maxsize The maximum number of items in the double array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_ENUM ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_STYLE(c,attrname,flags,"enum"); CLASS_ATTR_ATTR_PARSE(c,attrname,"enumvals",USESYM(atom),flags,parsestr); }

Add a new attribute to the specified attribute to specify a list of choices to display in a menu for the Max inspector.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
This macro automatically calls
   CLASS_ATTR_STYLE(c,attrname,flags,"enum").
See also:
CLASS_ATTR_ENUMINDEX
#define CLASS_ATTR_ENUMINDEX ( c,
attrname,
flags,
parsestr   )     { CLASS_ATTR_STYLE(c,attrname,flags,"enumindex"); CLASS_ATTR_ATTR_PARSE(c,attrname,"enumvals",USESYM(atom),flags,parsestr); }

Add a new attribute to the specified attribute to specify a list of choices to display in a menu for the Max inspector.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
This macro automatically calls
   CLASS_ATTR_STYLE(c,attrname,flags,"enumindex").
See also:
CLASS_ATTR_ENUM
#define CLASS_ATTR_FILTER_CLIP ( c,
attrname,
minval,
maxval   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      attr_addfilter_clip(theattr,minval,maxval,1,1); }

Add a filter to the attribute to limit both the lower and upper bounds of a value.

The limiting will be performed by the default attribute accessor.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
minval The maximum acceptable value to which the attribute will be limited.
maxval The maximum acceptable value to which the attribute will be limited.
See also:
#define CLASS_ATTR_FILTER_MAX ( c,
attrname,
maxval   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      attr_addfilter_clip(theattr,0,maxval,0,1); }

Add a filter to the attribute to limit the upper bound of a value.

The limiting will be performed by the default attribute accessor.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
maxval The maximum acceptable value to which the attribute will be limited.
See also:
CLASS_ATTR_FILTER_MIN
CLASS_ATTR_FILTER_CLIP
CLASS_ATTR_MAX
#define CLASS_ATTR_FILTER_MIN ( c,
attrname,
minval   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      attr_addfilter_clip(theattr,minval,0,1,0); }

Add a filter to the attribute to limit the lower bound of a value.

The limiting will be performed by the default attribute accessor.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
minval The minimum acceptable value to which the attribute will be limited.
See also:
CLASS_ATTR_FILTER_MAX
CLASS_ATTR_FILTER_CLIP
CLASS_ATTR_MIN
#define CLASS_ATTR_FLOAT ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(float32),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a 32-bit float attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_FLOAT_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(float32),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-32bit-floats attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of floats in the array.
#define CLASS_ATTR_FLOAT_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(float32),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-32bit-floats attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the float array at any given moment.
maxsize The maximum number of items in the float array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_INVISIBLE ( c,
attrname,
flags   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"invisible",USESYM(long),flags,"1")

Add a new attribute to the specified attribute to flag an attribute as invisible to the Max inspector.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_LABEL ( c,
attrname,
flags,
labelstr   )     CLASS_ATTR_ATTR_FORMAT(c,attrname,"label",USESYM(symbol),flags,"s",gensym(labelstr))

Add a new attribute to the specified attribute to specify an a human-friendly label for the Max inspector.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
labelstr A C-string, which will be parsed into an array of atoms to set the initial value.
#define CLASS_ATTR_LONG ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(long),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a long integer attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_LONG_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(long),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-long-integers attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of longs in the array.
#define CLASS_ATTR_LONG_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(long),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-long-integers attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the long array at any given moment.
maxsize The maximum number of items in the long array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_MAX ( c,
attrname,
flags,
parsestr   )     { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"max",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }

Add a new attribute to the specified attribute to specify an upper range.

The values will not be automatically limited.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_MIN
CLASS_ATTR_FILTER_MAX
CLASS_ATTR_FILTER_CLIP
#define CLASS_ATTR_MIN ( c,
attrname,
flags,
parsestr   )     { t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); CLASS_ATTR_ATTR_PARSE(c,attrname,"min",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }

Add a new attribute to the specified attribute to specify a lower range.

The values will not be automatically limited.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_MAX
CLASS_ATTR_FILTER_MAX
CLASS_ATTR_FILTER_CLIP
#define CLASS_ATTR_OBJ ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(object),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a t_object* attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_OBJ_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(object),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-objects attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_object* array.
#define CLASS_ATTR_OBJ_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(object),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-objects attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_object* array at any given moment.
maxsize The maximum number of items in the t_object* array, i.e. the number of members allocated for the array in the struct.
#define CLASS_ATTR_ORDER ( c,
attrname,
flags,
parsestr   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"order",USESYM(long),flags,parsestr)

Add a new attribute to the specified attribute to specify a default order in which to list attributes.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
A value of zero indicates that there is no ordering. Ordering values begin at 1. For example:
   CLASS_ATTR_ORDER(c, "firstattr", 0, "1");
   CLASS_ATTR_ORDER(c, "secondattr",   0, "2");
   CLASS_ATTR_ORDER(c, "thirdattr", 0, "3");
#define CLASS_ATTR_PAINT ( c,
attrname,
flags   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"paint",USESYM(long),flags,"1")

Add a new attribute indicating that any changes to the specified attribute will trigger a call to the object's paint method.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_REMOVE_FLAGS ( c,
attrname,
flags   ) 
Value:
{ t_object *theattr=(t_object *)class_attr_get(c,gensym(attrname)); \
      long oldflags = object_method(theattr,gensym("getflags")); \
      object_method(theattr,gensym("setflags"),oldflags&(~(flags))); }

Remove flags from an attribute.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to remove from this attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_RGBA ( c,
attrname,
flags,
structname,
structmember   ) 
Value:
{  CLASS_ATTR_DOUBLE_ARRAY(c,attrname,flags,structname,structmember,4); \
      CLASS_ATTR_ACCESSORS(c,attrname,NULL,jgraphics_attr_setrgba); \
      CLASS_ATTR_PAINT(c,attrname,0); }

Create a color (t_jrgba) attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_SAVE ( c,
attrname,
flags   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"save",USESYM(long),flags,"1")

Add a new attribute to the specified attribute to indicate that the specified attribute should be saved with the patcher.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_STYLE ( c,
attrname,
flags,
parsestr   )     CLASS_ATTR_ATTR_PARSE(c,attrname,"style",USESYM(symbol),flags,parsestr)

Add a new attribute to the specified attribute to specify an editor style for the Max inspector.

Available styles include

  • "text" : a text editor
  • "onoff" : a toggle switch
  • "rgba" : a color chooser
  • "enum" : a menu of available choices, whose symbol will be passed upon selection
  • "enumindex" : a menu of available choices, whose index will be passed upon selection
  • "rect" : a style for displaying and editing t_rect values
  • "font" : a font chooser
  • "file" : a file chooser dialog
Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
#define CLASS_ATTR_STYLE_LABEL ( c,
attrname,
flags,
stylestr,
labelstr   )     { CLASS_ATTR_ATTR_PARSE(c,attrname,"style",USESYM(symbol),flags,stylestr); CLASS_ATTR_ATTR_FORMAT(c,attrname,"label",USESYM(symbol),flags,"s",gensym(labelstr)); }

A convenience wrapper for CLASS_ATTR_STYLE, and CLASS_ATTR_LABEL.

Parameters:
c The class pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
stylestr A C-string that names the style for the attribute. See CLASS_ATTR_STYLE for the available styles.
labelstr A C-string that names the category to which the attribute is assigned in the inspector.
See also:
CLASS_ATTR_STYLE
CLASS_ATTR_LABEL
#define CLASS_ATTR_SYM ( c,
attrname,
flags,
structname,
structmember   )     class_addattr((c),attr_offset_new(attrname,USESYM(symbol),(flags),(method)0L,(method)0L,calcoffset(structname,structmember)))

Create a t_symbol* attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_SYM_ARRAY ( c,
attrname,
flags,
structname,
structmember,
size   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(symbol),(size),(flags),(method)0L,(method)0L,0/*fix*/,calcoffset(structname,structmember)))

Create an array-of-symbols attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_symbol* array.
#define CLASS_ATTR_SYM_VARSIZE ( c,
attrname,
flags,
structname,
structmember,
sizemember,
maxsize   )     class_addattr((c),attr_offset_array_new(attrname,USESYM(symbol),(maxsize),(flags),(method)0L,(method)0L,calcoffset(structname,sizemember),calcoffset(structname,structmember)))

Create an array-of-symbols attribute of variable length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_symbol* array at any given moment.
maxsize The maximum number of items in the t_symbol* array, i.e. the number of members allocated for the array in the struct.
#define CLASS_METHOD_ATTR_PARSE ( c,
methodname,
attrname,
type,
flags,
parsestring   ) 
Value:
{  t_hashtab *methods=NULL; \
      t_object *m=NULL; \
      methods = (t_hashtab *)class_extra_lookup(c,gensym("methods")); \
      if (methods) { \
         hashtab_lookup(methods,gensym((methodname)),&m); \
         if (m) \
            object_addattr_parse(m,attrname,type,flags,parsestring); \
      } \
   }

Define and add attributes to class methods.

Parameters:
c The class pointer.
methodname The name of the existing method as a C-string.
attrname The name of the attribute to add as a C-string.
type The datatype of the attribute to be added.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestring A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
An example which makes a method invisible to users:
   class_addmethod(c, (method)my_foo, "foo", 0);
   CLASS_METHOD_ATTR_PARSE(c, "foo", "undocumented", gensym("long"), 0, "1");
#define CLASS_STICKY_ATTR ( c,
name,
flags,
parsestr   )     { t_object *attr = attribute_new_parse(name,NULL,flags,parsestr); class_sticky(c,gensym("sticky_attr"),gensym(name),attr); }

Create an attribute, and add it to all following attribute declarations.

The block is closed by a call to CLASS_STICKY_ATTR_CLEAR.

Parameters:
c The class pointer.
name The name of the new attribute to create as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
The most common use of CLASS_STICKY_ATTR is for creating multiple attributes with the same category, as in this example:
   CLASS_STICKY_ATTR(c, "category", 0, "Foo");
   
   CLASS_ATTR_DOUBLE(c, "bar", 0, t_myobject, x_bar);
   CLASS_ATTR_LABEL(c, "bar", 0, "A Bar");

   CLASS_ATTR_CHAR(c, "switch", 0, t_myobject, x_switch);
   CLASS_ATTR_STYLE_LABEL(c, "switch", 0, "onoff", "Bar Switch");

   CLASS_ATTR_DOUBLE(c, "flow", 0, t_myobject, x_flow);
   CLASS_ATTR_LABEL(c, "flow",   0, "Flow Amount");
   
   CLASS_STICKY_ATTR_CLEAR(c, "category");
See also:
CLASS_STICKY_ATTR_CLEAR
#define CLASS_STICKY_ATTR_CLEAR ( c,
name   )     class_sticky_clear(c,gensym("sticky_attr"),name?gensym(name):NULL)

Close a CLASS_STICKY_ATTR block.

Parameters:
c The class pointer.
name The name of the sticky attribute as a C-string.
See also:
CLASS_STICKY_ATTR
#define CLASS_STICKY_METHOD ( c,
name,
flags,
parsestr   )     { t_object *attr = attribute_new_parse(name,NULL,flags,parsestr); class_sticky(c,gensym("sticky_method"),gensym(name),attr); }

Create an attribute, and add it to all following method declarations.

The block is closed by a call to CLASS_STICKY_METHOD_CLEAR.

Parameters:
c The class pointer.
name The name of the new attribute to create as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
Remarks:
The most common use of CLASS_STICKY_ATTR is for creating multiple attributes with the same category, as in this example:
   CLASS_STICKY_METHOD(c, "undocumented", 0, "1");
   
   // add some methods here with class_add_method()
   // the undocumented attribute for methods means that the ref-page 
   // generator will ignore these methods.
   
   CLASS_STICKY_METHOD_CLEAR(c, "undocumented");
See also:
CLASS_STICKY_METHOD_CLEAR
#define CLASS_STICKY_METHOD_CLEAR ( c,
name   )     class_sticky_clear(c,gensym("sticky_method"),name?gensym(name):clear)

Close a CLASS_STICKY_METHOD block.

Parameters:
c The class pointer.
name The name of the sticky attribute as a C-string.
See also:
CLASS_STICKY_METHOD
#define OBJ_ATTR_ATOM ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(atom),flags,"a",val)

Create an instance-local t_atom attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_ATOM_ARRAY   OBJ_ATTR_ATOMS

Create an instance-local array-of-atoms attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_atom array.
vals Pointer to the values.
#define OBJ_ATTR_CHAR ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(char),flags,"c",val)

Create an instance-local char attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_CHAR_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(char),flags,"C",count,vals)

Create an instance-local array-of-chars attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the char array.
vals Pointer to the values.
#define OBJ_ATTR_DEFAULT ( x,
attrname,
flags,
parsestr   )     { t_object *theattr=(t_object *)object_attr_get(x,gensym(attrname)); OBJ_ATTR_ATTR_PARSE(x,attrname,"default",(t_symbol *)object_method(theattr,USESYM(gettype)),flags,parsestr); }

An instance-attribute version of CLASS_ATTR_DEFAULT.

Parameters:
x The t_object instance pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULT
#define OBJ_ATTR_DEFAULT_SAVE ( x,
attrname,
flags,
parsestr   )     { OBJ_ATTR_DEFAULT(x,attrname,flags,parsestr); OBJ_ATTR_SAVE(x,attrname,flags); }

An instance-attribute version of CLASS_ATTR_DEFAULT_SAVE.

Parameters:
x The t_object instance pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestr A C-string, which will be parsed into an array of atoms to set the initial value.
See also:
CLASS_ATTR_DEFAULT_SAVE
#define OBJ_ATTR_DOUBLE ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(float64),flags,"d",val)

Create an instance-local 64bit float attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_DOUBLE_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(float64),flags,"D",count,vals)

Create an instance-local array-of-64bit-floats attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the double array.
vals Pointer to the values.
#define OBJ_ATTR_FLOAT ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(float32),flags,"f",val)

Create an instance-local 32bit float attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_FLOAT_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(float32),flags,"F",count,vals)

Create an instance-local array-of-32bit-floats attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the float array.
vals Pointer to the values.
#define OBJ_ATTR_LONG ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(long),flags,"l",val)

Create an instance-local long integer attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_LONG_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(long),flags,"L",count,vals)

Create an instance-local array-of-long-integers attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the long array.
vals Pointer to the values.
#define OBJ_ATTR_OBJ ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(object),flags,"o",val)

Create an instance-local t_object* attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_OBJ_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(object),flags,"O",count,vals)

Create an instance-local array-of-objects attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_object* array.
vals Pointer to the values.
#define OBJ_ATTR_SAVE ( x,
attrname,
flags   )     OBJ_ATTR_ATTR_PARSE(x,attrname,"save",USESYM(long),flags,"1")

An instance-attribute version of CLASS_ATTR_SAVE.

Parameters:
x The t_object instance pointer.
attrname The name of the attribute as a C-string.
flags Any flags you wish to declare for this new attribute, as defined in e_max_attrflags.
See also:
CLASS_ATTR_SAVE
#define OBJ_ATTR_SYM ( x,
attrname,
flags,
val   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(symbol),flags,"s",val)

Create an instance-local t_symbol* attribute and add it to a Max class.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define OBJ_ATTR_SYM_ARRAY ( x,
attrname,
flags,
count,
vals   )     OBJ_ATTR_FORMAT(x,attrname,USESYM(symbol),flags,"S",count,vals)

Create an instance-local array-of-symbols attribute of fixed length, and add it to the object.

Parameters:
x The object pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_symbol* array.
vals Pointer to the values.
#define STATIC_ATTR_ATOM ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(atom),flags,"a",val)

Create a shared (static/global) t_atom attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_ATOM_ARRAY   STATIC_ATTR_ATOMS

Create a shared (static/global) array-of-atoms attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_atom array.
vals Pointer to the values.
#define STATIC_ATTR_CHAR ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(char),flags,"c",val)

Create a shared (static/global) char attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_CHAR_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(char),flags,"C",count,vals)

Create a shared (static/global) array-of-chars attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the char array.
vals Pointer to the values.
#define STATIC_ATTR_DOUBLE ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(float64),flags,"d",val)

Create a shared (static/global) 64bit float attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_DOUBLE_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(float64),flags,"D",count,vals)

Create a shared (static/global) array-of-64bit-floats attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the double array.
vals Pointer to the values.
#define STATIC_ATTR_FLOAT ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(float32),flags,"f",val)

Create a shared (static/global) 32bit float attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_FLOAT_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(float32),flags,"F",count,vals)

Create a shared (static/global) array-of-32bit-floats attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the float array.
vals Pointer to the values.
#define STATIC_ATTR_LONG ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(long),flags,"l",val)

Create a shared (static/global) long integer attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_LONG_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(long),flags,"L",count,vals)

Create a shared (static/global) array-of-long-integers attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the long array.
vals Pointer to the values.
#define STATIC_ATTR_OBJ ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(object),flags,"o",val)

Create a shared (static/global) t_object* attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_OBJ_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(object),flags,"O",count,vals)

Create a shared (static/global) array-of-objects attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_object* array.
vals Pointer to the values.
#define STATIC_ATTR_SYM ( c,
attrname,
flags,
val   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(symbol),flags,"s",val)

Create a shared (static/global) t_symbol* attribute and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
val Pointer to the value.
#define STATIC_ATTR_SYM_ARRAY ( c,
attrname,
flags,
count,
vals   )     STATIC_ATTR_FORMAT(c,attrname,USESYM(symbol),flags,"S",count,vals)

Create a shared (static/global) array-of-symbols attribute of fixed length, and add it to a Max class.

Parameters:
c The class pointer.
attrname The name of this attribute as a C-string.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
count The number of items in the t_symbol* array.
vals Pointer to the values.
#define STRUCT_ATTR_ATOM ( c,
flags,
structname,
structmember   )     CLASS_ATTR_ATOM(c,#structmember,flags,structname,structmember)

Create a t_atom attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_ATOM_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_ATOM_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-atoms attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_atom array.
#define STRUCT_ATTR_ATOM_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_ATOM_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-atoms attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_atom array at any given moment.
maxsize The maximum number of items in the t_atom array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_CHAR ( c,
flags,
structname,
structmember   )     CLASS_ATTR_CHAR(c,#structmember,flags,structname,structmember)

Create a char attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_CHAR_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_CHAR_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-chars attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the char array.
#define STRUCT_ATTR_CHAR_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_CHAR_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-chars attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the char array at any given moment.
maxsize The maximum number of items in the char array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_DOUBLE ( c,
flags,
structname,
structmember   )     CLASS_ATTR_DOUBLE(c,#structmember,flags,structname,structmember)

Create a 64bit float attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_DOUBLE_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_DOUBLE_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-64bit-floats attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the double array.
#define STRUCT_ATTR_DOUBLE_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_DOUBLE_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-64bit-floats attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the double array at any given moment.
maxsize The maximum number of items in the double array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_FLOAT ( c,
flags,
structname,
structmember   )     CLASS_ATTR_FLOAT(c,#structmember,flags,structname,structmember)

Create a 32bit float attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_FLOAT_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_FLOAT_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-32bit-floats attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the floats array.
#define STRUCT_ATTR_FLOAT_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_FLOAT_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-32bit-floats attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the float array at any given moment.
maxsize The maximum number of items in the float array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_LONG ( c,
flags,
structname,
structmember   )     CLASS_ATTR_LONG(c,#structmember,flags,structname,structmember)

Create a long integer attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_LONG_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_LONG_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-long-integers attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the long array.
#define STRUCT_ATTR_LONG_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_LONG_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-long-integers attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the long array at any given moment.
maxsize The maximum number of items in the long array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_OBJ ( c,
flags,
structname,
structmember   )     CLASS_ATTR_OBJ(c,#structmember,flags,structname,structmember)

Create a t_object* attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_OBJ_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_OBJ_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-objects attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_object* array.
#define STRUCT_ATTR_OBJ_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_OBJ_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-objects attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_object* array at any given moment.
maxsize The maximum number of items in the t_object* array, i.e. the number of members allocated for the array in the struct.
#define STRUCT_ATTR_SYM ( c,
flags,
structname,
structmember   )     CLASS_ATTR_SYM(c,#structmember,flags,structname,structmember)

Create a t_symbol* attribute and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
#define STRUCT_ATTR_SYM_ARRAY ( c,
flags,
structname,
structmember,
size   )     CLASS_ATTR_SYM_ARRAY(c,#structmember,flags,structname,structmember,size)

Create an array-of-symbols attribute of fixed length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
size The number of items in the t_symbol* array.
#define STRUCT_ATTR_SYM_VARSIZE ( c,
flags,
structname,
structmember,
sizemember,
maxsize   )     CLASS_ATTR_SYM_VARSIZE(c,#structmember,flags,structname,structmember,sizemember,maxsize)

Create an array-of-symbols attribute of variable length, and add it to a Max class.

The name of the attribute is automatically determined by the name of the struct member.

Parameters:
c The class pointer.
flags Any flags you wish to declare for this attribute, as defined in e_max_attrflags.
structname The C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmember The C identifier of the member in the struct that holds the value of this attribute.
sizemember The actual number of items in the t_symbol* array at any given moment.
maxsize The maximum number of items in the t_symbol* array, i.e. the number of members allocated for the array in the struct.

Enumeration Type Documentation

Attribute flags.

Remarks:
To create a readonly attribute, for example, you should pass ATTR_SET_OPAQUE or ATTR_SET_OPAQUE_USER as a flag when you create your attribute.
Enumerator:
ATTR_FLAGS_NONE 

No flags.

ATTR_GET_OPAQUE 

The attribute cannot be queried by either max message when used inside of a CLASS_BOX object, nor from C code.

ATTR_SET_OPAQUE 

The attribute cannot be set by either max message when used inside of a CLASS_BOX object, nor from C code.

ATTR_GET_OPAQUE_USER 

The attribute cannot be queried by max message when used inside of a CLASS_BOX object, but can be queried from C code.

ATTR_SET_OPAQUE_USER 

The attribute cannot be set by max message when used inside of a CLASS_BOX object, but can be set from C code.


Function Documentation

t_max_err attr_addfilter_clip ( void *  x,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip filter to an attribute.

The filter will clip any values sent to or retrieved from the attribute using the attribute's get and set functions.

Parameters:
x Pointer to the attribute to receive the filter
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilter_clip_scale ( void *  x,
double  scale,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip/scale filter to an attribute.

The filter will clip and scale any values sent to or retrieved from the attribute using the attribute's get and set functions.

Parameters:
x Pointer to the attribute to receive the filter
scale Scale value. Data sent to the attribute will be scaled by this amount. Data retrieved from the attribute will be scaled by its reciprocal. Scaling occurs previous to clipping.
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilterget_clip ( void *  x,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip filter to an attribute.

The filter will only clip values retrieved from the attribute using the attribute's get function.

Parameters:
x Pointer to the attribute to receive the filter
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilterget_clip_scale ( void *  x,
double  scale,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip/scale filter to an attribute.

The filter will only clip and scale values retrieved from the attribute using the attribute's get function.

Parameters:
x Pointer to the attribute to receive the filter
scale Scale value. Data retrieved from the attribute will be scaled by this amount. Scaling occurs previous to clipping.
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilterget_proc ( void *  x,
method  proc 
)

Attaches a custom filter method to an attribute.

The filter will only be called for values retrieved from the attribute using the attribute's get function.

Parameters:
x Pointer to the attribute to receive the filter
proc A filter method
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
Remarks:
The filter method should be prototyped and implemented as described above for the attr_addfilterset_proc() function.
t_max_err attr_addfilterset_clip ( void *  x,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip filter to an attribute.

The filter will only clip values sent to the attribute using the attribute's set function.

Parameters:
x Pointer to the attribute to receive the filter
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilterset_clip_scale ( void *  x,
double  scale,
double  min,
double  max,
long  usemin,
long  usemax 
)

Attaches a clip/scale filter to an attribute.

The filter will only clip and scale values sent to the attribute using the attribute's set function.

Parameters:
x Pointer to the attribute to receive the filter
scale Scale value. Data sent to the attribute will be scaled by this amount. Scaling occurs previous to clipping.
min Minimum value for the clip filter
max Maximum value for the clip filter
usemin Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemax Sets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err attr_addfilterset_proc ( void *  x,
method  proc 
)

Attaches a custom filter method to an attribute.

The filter will only be called for values retrieved from the attribute using the attribute's set function.

Parameters:
x Pointer to the attribute to receive the filter
proc A filter method
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
Remarks:
The filter method should be prototyped and implemented as follows:
   t_max_err myfiltermethod(void *parent, void *attr, long ac, t_atom *av);

   t_max_err myfiltermethod(void *parent, void *attr, long ac, t_atom *av)
   {
      long i;
      float temp,

      // this filter rounds off all values
      // assumes that the data is float 
      for (i = 0; i < ac; i++) {
         temp = atom_getfloat(av + i);
         temp = (float)((long)(temp + 0.5));
         atom_setfloat(av + i, temp);
      }
      return MAX_ERR_NONE;
   }
void attr_args_dictionary ( t_dictionary x,
short  ac,
t_atom av 
)

Create a dictionary of attribute-name, attribute-value pairs from an array of atoms containing an attribute definition list.

Parameters:
x A dictionary instance pointer.
ac The number of atoms to parse in av.
av A pointer to the first of the array of atoms containing the attribute values.
Remarks:
The code example below shows the creation of a list of atoms using atom_setparse(), and then uses that list of atoms to fill the dictionary with attr_args_dictionary().
   long ac = 0;
   t_atom *av = NULL;
   char parsebuf[4096];
   t_dictionary *d = dictionary_new();
   t_atom a;
   
   sprintf(parsebuf,"@defrect %.6f %.6f %.6f %.6f @title Untitled @presentation 0 ", r->x, r->y, r->width, r->height);
   atom_setparse(&ac, &av, parsebuf);
   attr_args_dictionary(d, ac, av);
   atom_setobj(&a, d);
long attr_args_offset ( short  ac,
t_atom av 
)

Determines the point in an atom list where attribute arguments begin.

Developers can use this function to assist in the manual processing of attribute arguments, when attr_args_process() doesn't provide the correct functionality for a particular purpose.

Parameters:
ac The count of t_atoms in av
av An atom list
Returns:
This function returns an offset into the atom list, where the first attribute argument occurs. For instance, the atom list foo bar 3.0 @mode 6 would cause attr_args_offset to return 3 (the attribute mode appears at position 3 in the atom list).
void attr_args_process ( void *  x,
short  ac,
t_atom av 
)

Takes an atom list and properly set any attributes described within.

This function is typically used in an object's new method to conveniently process attribute arguments.

Parameters:
x The object whose attributes will be processed
ac The count of t_atoms in av
av An atom list
Remarks:
Here is a typical example of usage:
   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);
      }
      return x;
   }
void attr_dictionary_process ( void *  x,
t_dictionary d 
)

Set attributes for an object that are defined in a dictionary.

Objects with dictionary constructors, such as UI objects, should call this method to set their attributes when an object is created.

Parameters:
x The object instance pointer.
d The dictionary containing the attributes.
See also:
attr_args_process()
t_object* attr_offset_array_new ( C74_CONST char *  name,
t_symbol type,
long  size,
long  flags,
method  mget,
method  mset,
long  offsetcount,
long  offset 
)

Create a new attribute.

The attribute references an array of memory stored outside of itself, in the object's data structure. Attributes created using attr_offset_array_new() can be assigned either to classes (using the class_addattr() function) or to objects (using the object_addattr() function).

Parameters:
name A name for the attribute, as a C-string
type A t_symbol * representing a valid attribute type. At the time of this writing, the valid type-symbols are: _sym_char (char), _sym_long (long), _sym_float32 (32-bit float), _sym_float64 (64-bit float), _sym_atom (Max t_atom pointer), _sym_symbol (Max t_symbol pointer), _sym_pointer (generic pointer) and _sym_object (Max t_object pointer).
size Maximum number of items that may be in the array.
flags Any attribute flags, expressed as a bitfield. Attribute flags are used to determine if an attribute is accessible for setting or querying. The available accessor flags are defined in e_max_attrflags.
mget The method to use for the attribute's get functionality. If mget is NULL, the default method is used. See the discussion under attribute_new(), for more information.
mset The method to use for the attribute's set functionality. If mset is NULL, the default method is used. See the discussion under attribute_new(), for more information.
offsetcount Byte offset into the object class's data structure of a long variable describing how many array elements (up to size) comprise the data to be referenced by the attribute. Typically, the calcoffset macro is used to calculate this offset.
offset Byte offset into the class data structure of the object which will "own" the attribute. The offset should point to the data to be referenced by the attribute. Typically, the calcoffset macro is used to calculate this offset.
Returns:
This function returns the new attribute's object pointer if successful, or NULL if unsuccessful.
Remarks:
For instance, to create a new attribute which references an array of 10 t_atoms (atm; the current number of "active" elements in the array is held in the variable atmcount) in an object class's data structure:
   t_object *attr = attr_offset_array_new("myattrarray", _sym_atom / * matches data size * /, 10 / * max * /, 0 / * no flags * /, (method)0L, (method)0L, calcoffset(t_myobject, atmcount) / * count * /, calcoffset(t_myobject, atm) / * data * /);
t_object* attr_offset_new ( C74_CONST char *  name,
C74_CONST t_symbol type,
long  flags,
C74_CONST method  mget,
C74_CONST method  mset,
long  offset 
)

Create a new attribute.

The attribute references memory stored outside of itself, in the object's data structure. Attributes created using attr_offset_new() can be assigned either to classes (using the class_addattr() function) or to objects (using the object_addattr() function).

Parameters:
name A name for the attribute, as a C-string
type A t_symbol * representing a valid attribute type. At the time of this writing, the valid type-symbols are: _sym_char (char), _sym_long (long), _sym_float32 (32-bit float), _sym_float64 (64-bit float), _sym_atom (Max t_atom pointer), _sym_symbol (Max t_symbol pointer), _sym_pointer (generic pointer) and _sym_object (Max t_object pointer).
flags Any attribute flags, expressed as a bitfield. Attribute flags are used to determine if an attribute is accessible for setting or querying. The available accessor flags are defined in e_max_attrflags.
mget The method to use for the attribute's get functionality. If mget is NULL, the default method is used. See the discussion under attribute_new(), for more information.
mset The method to use for the attribute's set functionality. If mset is NULL, the default method is used. See the discussion under attribute_new(), for more information.
offset Byte offset into the class data structure of the object which will "own" the attribute. The offset should point to the data to be referenced by the attribute. Typically, the calcoffset macro (described above) is used to calculate this offset.
Returns:
This function returns the new attribute's object pointer if successful, or NULL if unsuccessful.
Remarks:
For instance, to create a new attribute which references the value of a double variable (val) in an object class's data structure:
   t_object *attr = attr_offset_new("myattr", _sym_float64 / * matches data size * /, 0 / * no flags * /, (method)0L, (method)0L, calcoffset(t_myobject, val));
t_object* attribute_new ( C74_CONST char *  name,
t_symbol type,
long  flags,
method  mget,
method  mset 
)

Create a new attribute.

The attribute will allocate memory and store its own data. Attributes created using attribute_new() can be assigned either to classes (using the class_addattr() function) or to objects (using the object_addattr() function).

Parameters:
name A name for the attribute, as a C-string
type A t_symbol * representing a valid attribute type. At the time of this writing, the valid type-symbols are: _sym_char (char), _sym_long (long), _sym_float32 (32-bit float), _sym_float64 (64-bit float), _sym_atom (Max t_atom pointer), _sym_symbol (Max t_symbol pointer), _sym_pointer (generic pointer) and _sym_object (Max t_object pointer).
flags Any attribute flags, expressed as a bitfield. Attribute flags are used to determine if an attribute is accessible for setting or querying. The available accessor flags are defined in e_max_attrflags.
mget The method to use for the attribute's get functionality. If mget is NULL, the default method is used.
mset The method to use for the attribute's set functionality. If mset is NULL, the default method is used.
Returns:
This function returns the new attribute's object pointer if successful, or NULL if unsuccessful.
Remarks:
Developers wishing to define custom methods for get or set functionality need to prototype them as:
   t_max_err myobject_myattr_get(t_myobject *x, void *attr, long *ac, t_atom **av);
   t_max_err myobject_myattr_set(t_myobject *x, void *attr, long ac, t_atom *av);
Implementation will vary, of course, but need to follow the following basic models. Note that, as with custom getvalueof and setvalueof methods for the object, assumptions are made throughout Max that getbytes() has been used for memory allocation. Developers are strongly urged to do the same:
   t_max_err myobject_myattr_get(t_myobject *x, void *attr, long *ac, t_atom **av)
   {
      if (*ac && *av)
         // memory passed in; use it
      else {
         *ac = 1; // size of attr data
         *av = (t_atom *)getbytes(sizeof(t_atom) * (*ac));
         if (!(*av)) {
            *ac = 0;
            return MAX_ERR_OUT_OF_MEM;
         }
      }
      atom_setlong(*av, x->some_value);
      return MAX_ERR_NONE;
   }

   t_max_err myobject_myattr_set(t_myobject *x, void *attr, long ac, t_atom *av)
   {
      if (ac && av) {
         x->some_value = atom_getlong(av);
      }
      return MAX_ERR_NONE;
   }
t_max_err object_addattr ( void *  x,
t_object attr 
)

Attaches an attribute directly to an object.

Parameters:
x An object to which the attribute should be attached
attr The attribute's pointer—this should be a pointer returned from attribute_new(), attr_offset_new() or attr_offset_array_new().
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
void* object_attr_get ( void *  x,
t_symbol attrname 
)

Returns the pointer to an attribute, given its name.

Parameters:
x Pointer to the object whose attribute is of interest
attrname The attribute's name
Returns:
This function returns a pointer to the attribute, if successful, or NULL, if unsuccessful.
t_max_err object_attr_get_rect ( t_object o,
t_symbol name,
t_rect rect 
)

Gets the value of a t_rect attribute, given its parent object and name.

Do not use this on a jbox object -- use jbox_get_rect_for_view() instead!

Parameters:
o The attribute's parent object
name The attribute's name
rect The address of a valid t_rect whose values will be filled-in from the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
long object_attr_getchar_array ( void *  x,
t_symbol s,
long  max,
uchar vals 
)

Retrieves the value of an attribute, given its parent object and name.

This function uses a developer-allocated array to copy data to. Developers wishing to retrieve the value of an attribute without pre-allocating memory should refer to the object_attr_getvalueof() function.

Parameters:
x The attribute's parent object
s The attribute's name
max The number of array elements in vals. The function will take care not to overwrite the bounds of the array.
vals Pointer to the first element of a pre-allocated array of unsigned char data.
Returns:
This function returns the number of elements copied into vals.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
t_max_err object_attr_getcolor ( t_object b,
t_symbol attrname,
t_jrgba prgba 
)

Gets the value of a t_jrgba attribute, given its parent object and name.

Parameters:
b The attribute's parent object
attrname The attribute's name
prgba The address of a valid t_jrgba whose values will be filled-in from the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
long object_attr_getdouble_array ( void *  x,
t_symbol s,
long  max,
double *  vals 
)

Retrieves the value of an attribute, given its parent object and name.

This function uses a developer-allocated array to copy data to. Developers wishing to retrieve the value of an attribute without pre-allocating memory should refer to the object_attr_getvalueof() function.

Parameters:
x The attribute's parent object
s The attribute's name
max The number of array elements in vals. The function will take care not to overwrite the bounds of the array.
vals Pointer to the first element of a pre-allocated array of double data.
Returns:
This function returns the number of elements copied into vals.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
void object_attr_getdump ( void *  x,
t_symbol s,
long  argc,
t_atom argv 
)

Forces a specified object's attribute to send its value from the object's dumpout outlet in the Max interface.

Parameters:
x Pointer to the object whose attribute is of interest
s The attribute's name
argc Unused
argv Unused
float object_attr_getfloat ( void *  x,
t_symbol s 
)

Retrieves the value of an attribute, given its parent object and name.

Parameters:
x The attribute's parent object
s The attribute's name
Returns:
This function returns the value of the specified attribute, if successful, or 0, if unsuccessful.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
long object_attr_getfloat_array ( void *  x,
t_symbol s,
long  max,
float *  vals 
)

Retrieves the value of an attribute, given its parent object and name.

This function uses a developer-allocated array to copy data to. Developers wishing to retrieve the value of an attribute without pre-allocating memory should refer to the object_attr_getvalueof() function.

Parameters:
x The attribute's parent object
s The attribute's name
max The number of array elements in vals. The function will take care not to overwrite the bounds of the array.
vals Pointer to the first element of a pre-allocated array of float data.
Returns:
This function returns the number of elements copied into vals.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
t_max_err object_attr_getjrgba ( void *  ob,
t_symbol s,
t_jrgba c 
)

Retrieves the value of a color attribute, given its parent object and name.

Parameters:
ob The attribute's parent object
s The attribute's name
c The address of a t_jrgba struct that will be filled with the attribute's color component values.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
long object_attr_getlong ( void *  x,
t_symbol s 
)

Retrieves the value of an attribute, given its parent object and name.

Parameters:
x The attribute's parent object
s The attribute's name
Returns:
This function returns the value of the specified attribute, if successful, or 0, if unsuccessful.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
long object_attr_getlong_array ( void *  x,
t_symbol s,
long  max,
long *  vals 
)

Retrieves the value of an attribute, given its parent object and name.

This function uses a developer-allocated array to copy data to. Developers wishing to retrieve the value of an attribute without pre-allocating memory should refer to the object_attr_getvalueof() function.

Parameters:
x The attribute's parent object
s The attribute's name
max The number of array elements in vals. The function will take care not to overwrite the bounds of the array.
vals Pointer to the first element of a pre-allocated array of long data.
Returns:
This function returns the number of elements copied into vals.
Remarks:
If the attribute is not of the type specified by the function, the function will attempt to coerce a valid value from the attribute.
t_max_err object_attr_getpt ( t_object o,
t_symbol name,
t_pt pt 
)

Gets the value of a t_pt attribute, given its parent object and name.

Parameters:
o The attribute's parent object
name The attribute's name
pt The address of a valid t_pt whose values will be filled-in from the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_getsize ( t_object o,
t_symbol name,
t_size size 
)

Gets the value of a t_size attribute, given its parent object and name.

Parameters:
o The attribute's parent object
name The attribute's name
size The address of a valid t_size whose values will be filled-in from the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_symbol* object_attr_getsym ( void *  x,
t_symbol s 
)

Retrieves the value of an attribute, given its parent object and name.

Parameters:
x The attribute's parent object
s The attribute's name
Returns:
This function returns the value of the specified attribute, if successful, or the empty symbol (equivalent to gensym("") or _sym_nothing), if unsuccessful.
long object_attr_getsym_array ( void *  x,
t_symbol s,
long  max,
t_symbol **  vals 
)

Retrieves the value of an attribute, given its parent object and name.

This function uses a developer-allocated array to copy data to. Developers wishing to retrieve the value of an attribute without pre-allocating memory should refer to the object_attr_getvalueof() function.

Parameters:
x The attribute's parent object
s The attribute's name
max The number of array elements in vals. The function will take care not to overwrite the bounds of the array.
vals Pointer to the first element of a pre-allocated array of t_symbol *s.
Returns:
This function returns the number of elements copied into vals.
method object_attr_method ( void *  x,
t_symbol methodname,
void **  attr,
long *  get 
)

Returns the method of an attribute's get or set function, as well as a pointer to the attribute itself, from a message name.

Parameters:
x Pointer to the object whose attribute is of interest
methodname The Max message used to call the attribute's get or set function. For example, gensym("mode") or gensym("getthresh").
attr A pointer to a void *, which will be set to the attribute pointer upon successful completion of the function
get A pointer to a long variable, which will be set to 1 upon successful completion of the function, if the queried method corresponds to the get function of the attribute.
Returns:
This function returns the requested method, if successful, or NULL, if unsuccessful.
t_max_err object_attr_set_rect ( t_object o,
t_symbol name,
t_rect rect 
)

Sets the value of a t_rect attribute, given its parent object and name.

Do not use this on a jbox object -- use jbox_get_rect_for_view() instead!

Parameters:
o The attribute's parent object
name The attribute's name
rect The address of a valid t_rect whose values will be used to set the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setchar_array ( void *  x,
t_symbol s,
long  count,
C74_CONST uchar vals 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
count The number of array elements in vals
vals Pointer to the first element of an array of unsigned char data
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setcolor ( t_object b,
t_symbol attrname,
t_jrgba prgba 
)

Sets the value of a t_jrgba attribute, given its parent object and name.

Parameters:
b The attribute's parent object
attrname The attribute's name
prgba The address of a valid t_jrgba whose values will be used to set the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setdouble_array ( void *  x,
t_symbol s,
long  count,
double *  vals 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
count The number of array elements in vals
vals Pointer to the first element of an array of double data
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setfloat ( void *  x,
t_symbol s,
float  c 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
c An floating point value; the new value for the attribute
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setfloat_array ( void *  x,
t_symbol s,
long  count,
float *  vals 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
count The number of array elements in vals
vals Pointer to the first element of an array of float data
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setjrgba ( void *  ob,
t_symbol s,
t_jrgba c 
)

Sets the value of a color attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
ob The attribute's parent object
s The attribute's name
c The address of a t_jrgba struct that contains the new color.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setlong ( void *  x,
t_symbol s,
long  c 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
c An integer value; the new value for the attribute
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setlong_array ( void *  x,
t_symbol s,
long  count,
long *  vals 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
count The number of array elements in vals
vals Pointer to the first element of an array of long data
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setparse ( t_object x,
t_symbol s,
C74_CONST char *  parsestr 
)

Set an attribute value with one or more atoms parsed from a C-string.

Parameters:
x The object whose attribute will be set.
s The name of the attribute to set.
parsestr A C-string to parse into an array of atoms to set the attribute value.
Returns:
A Max error code.
See also:
atom_setparse()
t_max_err object_attr_setpt ( t_object o,
t_symbol name,
t_pt pt 
)

Sets the value of a t_pt attribute, given its parent object and name.

Parameters:
o The attribute's parent object
name The attribute's name
pt The address of a valid t_pt whose values will be used to set the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setsize ( t_object o,
t_symbol name,
t_size size 
)

Sets the value of a t_size attribute, given its parent object and name.

Parameters:
o The attribute's parent object
name The attribute's name
size The address of a valid t_size whose values will be used to set the attribute.
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setsym ( void *  x,
t_symbol s,
t_symbol c 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
c A t_symbol *; the new value for the attribute
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setsym_array ( void *  x,
t_symbol s,
long  count,
t_symbol **  vals 
)

Sets the value of an attribute, given its parent object and name.

The function will call the attribute's set method, using the data provided.

Parameters:
x The attribute's parent object
s The attribute's name
count The number of array elements in vals
vals Pointer to the first element of an array of t_symbol *s
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_attr_setvalueof ( void *  x,
t_symbol s,
long  argc,
t_atom argv 
)

Sets the value of an object's attribute.

Parameters:
x Pointer to the object whose attribute is of interest
s The attribute's name
argc The count of arguments in argv
argv Array of t_atoms; the new desired data for the attribute
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
long object_attr_usercanget ( void *  x,
t_symbol s 
)

Determines if the value of an object's attribute can be queried from the Max interface (i.e.

if its ATTR_GET_OPAQUE_USER flag is set).

Parameters:
x Pointer to the object whose attribute is of interest
s The attribute's name
Returns:
This function returns 1 if the value of the attribute can be queried from the Max interface. Otherwise, it returns 0.
long object_attr_usercanset ( void *  x,
t_symbol s 
)

Determines if an object's attribute can be set from the Max interface (i.e.

if its ATTR_SET_OPAQUE_USER flag is set).

Parameters:
x Pointer to the object whose attribute is of interest
s The attribute's name
Returns:
This function returns 1 if the attribute can be set from the Max interface. Otherwise, it returns 0.
t_max_err object_chuckattr ( void *  x,
t_symbol attrsym 
)

Detach an attribute from an object that was previously attached with object_addattr().

This function will not free the attribute (use object_free() to do this manually).

Parameters:
x The object to which the attribute is attached
attrsym The attribute's name
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
t_max_err object_deleteattr ( void *  x,
t_symbol attrsym 
)

Detach an attribute from an object that was previously attached with object_addattr().

The function will also free all memory associated with the attribute. If you only wish to detach the attribute, without freeing it, see the object_chuckattr() function.

Parameters:
x The object to which the attribute is attached
attrsym The attribute's name
Returns:
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in e_max_errorcodes if unsuccessful.
void* object_new_parse ( t_symbol name_space,
t_symbol classname,
C74_CONST char *  parsestr 
)

Create a new object with one or more atoms parsed from a C-string.

The object's new method must have an A_GIMME signature.

Parameters:
name_space The namespace in which to create the instance. Typically this is either CLASS_BOX or CLASS_NOBOX.
classname The name of the class to instantiate.
parsestr A C-string to parse into an array of atoms to set the attribute value.
Returns:
A pointer to the new instance.
See also:
atom_setparse()
object_new_typed()

Copyright © 2008, Cycling '74