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)
 Create a char attribute and add it to a Max class.
#define CLASS_ATTR_LONG(c, attrname, flags, structname, structmember)
 Create a long integer attribute and add it to a Max class.
#define CLASS_ATTR_FLOAT(c, attrname, flags, structname, structmember)
 Create a 32-bit float attribute and add it to a Max class.
#define CLASS_ATTR_DOUBLE(c, attrname, flags, structname, structmember)
 Create a 64-bit float attribute and add it to a Max class.
#define CLASS_ATTR_SYM(c, attrname, flags, structname, structmember)
 Create a t_symbol* attribute and add it to a Max class.
#define CLASS_ATTR_ATOM(c, attrname, flags, structname, structmember)
 Create a t_atom attribute and add it to a Max class.
#define CLASS_ATTR_OBJ(c, attrname, flags, 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 Create an array-of-objects attribute of variable length, and add it to a Max class.
#define STRUCT_ATTR_CHAR(c, flags, structname, structmember)
 Create a char attribute and add it to a Max class.
#define STRUCT_ATTR_LONG(c, flags, structname, structmember)
 Create a long integer attribute and add it to a Max class.
#define STRUCT_ATTR_FLOAT(c, flags, structname, structmember)
 Create a 32bit float attribute and add it to a Max class.
#define STRUCT_ATTR_DOUBLE(c, flags, structname, structmember)
 Create a 64bit float attribute and add it to a Max class.
#define STRUCT_ATTR_SYM(c, flags, structname, structmember)
 Create a t_symbol* attribute and add it to a Max class.
#define STRUCT_ATTR_ATOM(c, flags, structname, structmember)
 Create a t_atom attribute and add it to a Max class.
#define STRUCT_ATTR_OBJ(c, 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 Create an array-of-objects attribute of variable length, and add it to a Max class.
#define STATIC_ATTR_CHAR(c, attrname, flags, val)
 Create a shared (static/global) char attribute and add it to a Max class.
#define STATIC_ATTR_LONG(c, attrname, flags, val)
 Create a shared (static/global) long integer attribute and add it to a Max class.
#define STATIC_ATTR_FLOAT(c, attrname, flags, val)
 Create a shared (static/global) 32bit float attribute and add it to a Max class.
#define STATIC_ATTR_DOUBLE(c, attrname, flags, val)
 Create a shared (static/global) 64bit float attribute and add it to a Max class.
#define STATIC_ATTR_SYM(c, attrname, flags, val)
 Create a shared (static/global) t_symbol* attribute and add it to a Max class.
#define STATIC_ATTR_ATOM(c, attrname, flags, val)
 Create a shared (static/global) t_atom attribute and add it to a Max class.
#define STATIC_ATTR_OBJ(c, attrname, flags, 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)
 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)
 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)
 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)
 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)
 Create a shared (static/global) array-of-symbols attribute of fixed length, and add it to a Max class.
#define STATIC_ATTR_ATOM_ARRAY
 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)
 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)
 Create an instance-local char attribute and add it to a Max class.
#define OBJ_ATTR_LONG(x, attrname, flags, val)
 Create an instance-local long integer attribute and add it to a Max class.
#define OBJ_ATTR_FLOAT(x, attrname, flags, val)
 Create an instance-local 32bit float attribute and add it to a Max class.
#define OBJ_ATTR_DOUBLE(x, attrname, flags, val)
 Create an instance-local 64bit float attribute and add it to a Max class.
#define OBJ_ATTR_SYM(x, attrname, flags, val)
 Create an instance-local t_symbol* attribute and add it to a Max class.
#define OBJ_ATTR_ATOM(x, attrname, flags, val)
 Create an instance-local t_atom attribute and add it to a Max class.
#define OBJ_ATTR_OBJ(x, attrname, flags, 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)
 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)
 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)
 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)
 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)
 Create an instance-local array-of-symbols attribute of fixed length, and add it to the object.
#define OBJ_ATTR_ATOM_ARRAY
 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)
 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)
 Add a new attribute to the specified attribute to specify a default value.
#define CLASS_ATTR_SAVE(c, attrname, flags)
 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)
 A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_SAVE.
#define CLASS_ATTR_DEFAULTNAME(c, attrname, 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)
 A convenience wrapper for both CLASS_ATTR_DEFAULTNAME and CLASS_ATTR_SAVE.
#define CLASS_ATTR_MIN(c, attrname, flags, parsestr)
 Add a new attribute to the specified attribute to specify a lower range.
#define CLASS_ATTR_MAX(c, attrname, flags, parsestr)
 Add a new attribute to the specified attribute to specify an upper range.
#define CLASS_ATTR_PAINT(c, attrname, flags)
 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)
 A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULT_SAVE_PAINT(c, attrname, flags, parsestr)
 A convenience wrapper for CLASS_ATTR_DEFAULT, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULTNAME_PAINT(c, attrname, flags, parsestr)
 A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c, attrname, flags, parsestr)
 A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.
#define CLASS_ATTR_STYLE(c, attrname, 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)
 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)
 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)
 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)
 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)
 A convenience wrapper for CLASS_ATTR_STYLE, and CLASS_ATTR_LABEL.
#define CLASS_ATTR_INVISIBLE(c, attrname, flags)
 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)
 Add a new attribute to the specified attribute to specify a default order in which to list attributes.
#define CLASS_ATTR_BASIC(c, attrname, flags)
 Add a new attribute to the specified attribute to specify that it should appear in the inspector's Basic tab.
#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)
 An instance-attribute version of CLASS_ATTR_DEFAULT.
#define OBJ_ATTR_SAVE(x, attrname, flags)
 An instance-attribute version of CLASS_ATTR_SAVE.
#define OBJ_ATTR_DEFAULT_SAVE(x, attrname, flags, parsestr)
 An instance-attribute version of CLASS_ATTR_DEFAULT_SAVE.
#define CLASS_STICKY_ATTR(c, name, flags, parsestr)
 Create an attribute, and add it to all following attribute declarations.
#define CLASS_STICKY_ATTR_CLEAR(c, name)
 Close a CLASS_STICKY_ATTR block.
#define CLASS_STICKY_METHOD(c, name, flags, parsestr)
 Create an attribute, and add it to all following method declarations.
#define CLASS_STICKY_METHOD_CLEAR(c, name)
 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, ATTR_GET_OPAQUE, ATTR_SET_OPAQUE, ATTR_GET_OPAQUE_USER,
  ATTR_SET_OPAQUE_USER
}
 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 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
getterAn appropriate getter method as discussed in Setting and Getting Attribute Values, or NULL to use the default getter.
setterAn 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 
)

Add flags to an attribute.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to add to this attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_ALIAS (   c,
  attrname,
  aliasname 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the actual attribute as a C-string.
aliasnameThe name of the new alias attribute.
#define CLASS_ATTR_ATOM (   c,
  attrname,
  flags,
  structname,
  structmember 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_atom array.
#define CLASS_ATTR_ATOM_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_atom array at any given moment.
maxsizeThe 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_BASIC (   c,
  attrname,
  flags 
)

Add a new attribute to the specified attribute to specify that it should appear in the inspector's Basic tab.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_CATEGORY (   c,
  attrname,
  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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of chars in the array.
#define CLASS_ATTR_CHAR_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the char array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_PAINT.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for both CLASS_ATTR_DEFAULT and CLASS_ATTR_SAVE.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for CLASS_ATTR_DEFAULT, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for both CLASS_ATTR_DEFAULTNAME and CLASS_ATTR_SAVE.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for CLASS_ATTR_DEFAULTNAME, CLASS_ATTR_SAVE, and CLASS_ATTR_PAINT.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of doubles in the array.
#define CLASS_ATTR_DOUBLE_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the double array at any given moment.
maxsizeThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
minvalThe maximum acceptable value to which the attribute will be limited.
maxvalThe maximum acceptable value to which the attribute will be limited.
See also:
#define CLASS_ATTR_FILTER_MAX (   c,
  attrname,
  maxval 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
maxvalThe 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 
)

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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
minvalThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of floats in the array.
#define CLASS_ATTR_FLOAT_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the float array at any given moment.
maxsizeThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_LABEL (   c,
  attrname,
  flags,
  labelstr 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
labelstrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of longs in the array.
#define CLASS_ATTR_LONG_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the long array at any given moment.
maxsizeThe 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 
)

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

The values will not be automatically limited.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

The values will not be automatically limited.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_object* array.
#define CLASS_ATTR_OBJ_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_object* array at any given moment.
maxsizeThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_REMOVE_FLAGS (   c,
  attrname,
  flags 
)

Remove flags from an attribute.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to remove from this attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_RGBA (   c,
  attrname,
  flags,
  structname,
  structmember 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
#define CLASS_ATTR_SAVE (   c,
  attrname,
  flags 
)

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

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
#define CLASS_ATTR_STYLE (   c,
  attrname,
  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:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

A convenience wrapper for CLASS_ATTR_STYLE, and CLASS_ATTR_LABEL.

Parameters:
cThe class pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
stylestrA C-string that names the style for the attribute. See CLASS_ATTR_STYLE for the available styles.
labelstrA 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_symbol* array.
#define CLASS_ATTR_SYM_VARSIZE (   c,
  attrname,
  flags,
  structname,
  structmember,
  sizemember,
  maxsize 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_symbol* array at any given moment.
maxsizeThe 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 
)

Define and add attributes to class methods.

Parameters:
cThe class pointer.
methodnameThe name of the existing method as a C-string.
attrnameThe name of the attribute to add as a C-string.
typeThe datatype of the attribute to be added.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestringA 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 
)

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

The block is closed by a call to CLASS_STICKY_ATTR_CLEAR.

Parameters:
cThe class pointer.
nameThe name of the new attribute to create as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

Close a CLASS_STICKY_ATTR block.

Parameters:
cThe class pointer.
nameThe name of the sticky attribute as a C-string.
See also:
CLASS_STICKY_ATTR
#define CLASS_STICKY_METHOD (   c,
  name,
  flags,
  parsestr 
)

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

The block is closed by a call to CLASS_STICKY_METHOD_CLEAR.

Parameters:
cThe class pointer.
nameThe name of the new attribute to create as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

Close a CLASS_STICKY_METHOD block.

Parameters:
cThe class pointer.
nameThe name of the sticky attribute as a C-string.
See also:
CLASS_STICKY_METHOD
#define OBJ_ATTR_ATOM (   x,
  attrname,
  flags,
  val 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_ATOM_ARRAY

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_atom array.
valsPointer to the values.
#define OBJ_ATTR_CHAR (   x,
  attrname,
  flags,
  val 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_CHAR_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the char array.
valsPointer to the values.
#define OBJ_ATTR_DEFAULT (   x,
  attrname,
  flags,
  parsestr 
)

An instance-attribute version of CLASS_ATTR_DEFAULT.

Parameters:
xThe t_object instance pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

An instance-attribute version of CLASS_ATTR_DEFAULT_SAVE.

Parameters:
xThe t_object instance pointer.
attrnameThe name of the attribute as a C-string.
flagsAny flags you wish to declare for this new attribute, as defined in e_max_attrflags.
parsestrA 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 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_DOUBLE_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the double array.
valsPointer to the values.
#define OBJ_ATTR_FLOAT (   x,
  attrname,
  flags,
  val 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_FLOAT_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the float array.
valsPointer to the values.
#define OBJ_ATTR_LONG (   x,
  attrname,
  flags,
  val 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_LONG_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the long array.
valsPointer to the values.
#define OBJ_ATTR_OBJ (   x,
  attrname,
  flags,
  val 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_OBJ_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_object* array.
valsPointer to the values.
#define OBJ_ATTR_SAVE (   x,
  attrname,
  flags 
)

An instance-attribute version of CLASS_ATTR_SAVE.

Parameters:
xThe t_object instance pointer.
attrnameThe name of the attribute as a C-string.
flagsAny 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 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define OBJ_ATTR_SYM_ARRAY (   x,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
xThe object pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_symbol* array.
valsPointer to the values.
#define STATIC_ATTR_ATOM (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_ATOM_ARRAY

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_atom array.
valsPointer to the values.
#define STATIC_ATTR_CHAR (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_CHAR_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the char array.
valsPointer to the values.
#define STATIC_ATTR_DOUBLE (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_DOUBLE_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the double array.
valsPointer to the values.
#define STATIC_ATTR_FLOAT (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_FLOAT_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the float array.
valsPointer to the values.
#define STATIC_ATTR_LONG (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_LONG_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the long array.
valsPointer to the values.
#define STATIC_ATTR_OBJ (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_OBJ_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_object* array.
valsPointer to the values.
#define STATIC_ATTR_SYM (   c,
  attrname,
  flags,
  val 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
valPointer to the value.
#define STATIC_ATTR_SYM_ARRAY (   c,
  attrname,
  flags,
  count,
  vals 
)

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

Parameters:
cThe class pointer.
attrnameThe name of this attribute as a C-string.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
countThe number of items in the t_symbol* array.
valsPointer to the values.
#define STRUCT_ATTR_ATOM (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_atom array.
#define STRUCT_ATTR_ATOM_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_atom array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the char array.
#define STRUCT_ATTR_CHAR_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the char array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the double array.
#define STRUCT_ATTR_DOUBLE_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the double array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the floats array.
#define STRUCT_ATTR_FLOAT_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the float array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the long array.
#define STRUCT_ATTR_LONG_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the long array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_object* array.
#define STRUCT_ATTR_OBJ_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_object* array at any given moment.
maxsizeThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe 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 
)

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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizeThe number of items in the t_symbol* array.
#define STRUCT_ATTR_SYM_VARSIZE (   c,
  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:
cThe class pointer.
flagsAny flags you wish to declare for this attribute, as defined in e_max_attrflags.
structnameThe C identifier for the struct (containing a valid t_object header) representing an instance of this class.
structmemberThe C identifier of the member in the struct that holds the value of this attribute.
sizememberThe actual number of items in the t_symbol* array at any given moment.
maxsizeThe 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:
xPointer to the attribute to receive the filter
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
scaleScale 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.
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
scaleScale value. Data retrieved from the attribute will be scaled by this amount. Scaling occurs previous to clipping.
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
procA 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:
xPointer to the attribute to receive the filter
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
scaleScale value. Data sent to the attribute will be scaled by this amount. Scaling occurs previous to clipping.
minMinimum value for the clip filter
maxMaximum value for the clip filter
useminSets this value to 0 if the minimum clip value should not be used. Otherwise, set the value to non-zero.
usemaxSets 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:
xPointer to the attribute to receive the filter
procA 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:
xA dictionary instance pointer.
acThe number of atoms to parse in av.
avA 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:
acThe count of t_atoms in av
avAn 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:
xThe object whose attributes will be processed
acThe count of t_atoms in av
avAn 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:
xThe object instance pointer.
dThe 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:
nameA name for the attribute, as a C-string
typeA 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).
sizeMaximum number of items that may be in the array.
flagsAny 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.
mgetThe 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.
msetThe 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.
offsetcountByte 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.
offsetByte 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:
nameA name for the attribute, as a C-string
typeA 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).
flagsAny 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.
mgetThe 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.
msetThe 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.
offsetByte 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:
nameA name for the attribute, as a C-string
typeA 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).
flagsAny 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.
mgetThe method to use for the attribute's get functionality. If mget is NULL, the default method is used.
msetThe 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:
xAn object to which the attribute should be attached
attrThe 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:
xPointer to the object whose attribute is of interest
attrnameThe 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:
oThe attribute's parent object
nameThe attribute's name
rectThe 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:
xThe attribute's parent object
sThe attribute's name
maxThe number of array elements in vals. The function will take care not to overwrite the bounds of the array.
valsPointer 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:
bThe attribute's parent object
attrnameThe attribute's name
prgbaThe 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:
xThe attribute's parent object
sThe attribute's name
maxThe number of array elements in vals. The function will take care not to overwrite the bounds of the array.
valsPointer 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:
xPointer to the object whose attribute is of interest
sThe attribute's name
argcUnused
argvUnused
float object_attr_getfloat ( void *  x,
t_symbol s 
)

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

Parameters:
xThe attribute's parent object
sThe 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:
xThe attribute's parent object
sThe attribute's name
maxThe number of array elements in vals. The function will take care not to overwrite the bounds of the array.
valsPointer 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:
obThe attribute's parent object
sThe attribute's name
cThe 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:
xThe attribute's parent object
sThe 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:
xThe attribute's parent object
sThe attribute's name
maxThe number of array elements in vals. The function will take care not to overwrite the bounds of the array.
valsPointer 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:
oThe attribute's parent object
nameThe attribute's name
ptThe 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:
oThe attribute's parent object
nameThe attribute's name
sizeThe 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:
xThe attribute's parent object
sThe 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:
xThe attribute's parent object
sThe attribute's name
maxThe number of array elements in vals. The function will take care not to overwrite the bounds of the array.
valsPointer 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:
xPointer to the object whose attribute is of interest
methodnameThe Max message used to call the attribute's get or set function. For example, gensym("mode") or gensym("getthresh").
attrA pointer to a void *, which will be set to the attribute pointer upon successful completion of the function
getA 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:
oThe attribute's parent object
nameThe attribute's name
rectThe 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:
xThe attribute's parent object
sThe attribute's name
countThe number of array elements in vals
valsPointer 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:
bThe attribute's parent object
attrnameThe attribute's name
prgbaThe 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:
xThe attribute's parent object
sThe attribute's name
countThe number of array elements in vals
valsPointer 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:
xThe attribute's parent object
sThe attribute's name
cAn 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:
xThe attribute's parent object
sThe attribute's name
countThe number of array elements in vals
valsPointer 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:
obThe attribute's parent object
sThe attribute's name
cThe 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:
xThe attribute's parent object
sThe attribute's name
cAn 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:
xThe attribute's parent object
sThe attribute's name
countThe number of array elements in vals
valsPointer 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:
xThe object whose attribute will be set.
sThe name of the attribute to set.
parsestrA 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:
oThe attribute's parent object
nameThe attribute's name
ptThe 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:
oThe attribute's parent object
nameThe attribute's name
sizeThe 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:
xThe attribute's parent object
sThe attribute's name
cA 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:
xThe attribute's parent object
sThe attribute's name
countThe number of array elements in vals
valsPointer 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:
xPointer to the object whose attribute is of interest
sThe attribute's name
argcThe count of arguments in argv
argvArray 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:
xPointer to the object whose attribute is of interest
sThe 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:
xPointer to the object whose attribute is of interest
sThe 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:
xThe object to which the attribute is attached
attrsymThe 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:
xThe object to which the attribute is attached
attrsymThe 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_spaceThe namespace in which to create the instance. Typically this is either CLASS_BOX or CLASS_NOBOX.
classnameThe name of the class to instantiate.
parsestrA 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()