Max 5 API Reference
![]() |
Functions | |
void | setup (t_messlist **ident, method makefun, method freefun, short size, method menufun, short type,...) |
Use the setup() function to initialize your class by informing Max of its size, the name of your functions that create and destroy instances, and the types of arguments passed to the instance creation function. | |
void | addmess (method f, char *s, short type,...) |
Use addmess() to bind a function to a message other than the standard ones covered by addbang(), addint(), etc. | |
void | addbang (method f) |
Used to bind a function to the common triggering message bang. | |
void | addint (method f) |
Use addint() to bind a function to the int message received in the leftmost inlet. | |
void | addfloat (method f) |
Use addfloat() to bind a function to the float message received in the leftmost inlet. | |
void | addinx (method f, short n) |
Use addinx() to bind a function to a int message that will be received in an inlet other than the leftmost one. | |
void | addftx (method f, short n) |
Use addftx() to bind a function to a float message that will be received in an inlet other than the leftmost one. | |
void * | newobject (void *maxclass) |
Use newobject to allocate the space for an instance of your class and initialize its object header. | |
void | freeobject (t_object *op) |
Release the memory used by a Max object. | |
void * | newinstance (t_symbol *s, short argc, t_atom *argv) |
Make a new instance of an existing Max class. | |
void | alias (char *name) |
Use the alias function to allow users to refer to your object by a name other than that of your shared library. | |
void | class_setname (char *obname, char *filename) |
Use class_setname() to associate you object’s name with it’s filename on disk. | |
void * | typedmess (t_object *op, t_symbol *msg, short argc, t_atom *argp) |
Send a typed message directly to a Max object. | |
method | getfn (t_object *op, t_symbol *msg) |
Use getfn() to send an untyped message to a Max object with error checking. | |
method | egetfn (t_object *op, t_symbol *msg) |
Use egetfn() to send an untyped message to a Max object that always works. | |
method | zgetfn (t_object *op, t_symbol *msg) |
Use zgetfn() to send an untyped message to a Max object without error checking. |
void addbang | ( | method | f | ) |
Used to bind a function to the common triggering message bang.
f | Function to be the bang method. |
Referenced by max_jit_classex_mop_wrap(), and max_ob3d_setup().
void addfloat | ( | method | f | ) |
Use addfloat() to bind a function to the float message received in the leftmost inlet.
f | Function to be the int method. |
void addftx | ( | method | f, | |
short | n | |||
) |
Use addftx() to bind a function to a float message that will be received in an inlet other than the leftmost one.
f | Function to be the float method. | |
n | Number of the inlet connected to this method. 1 is the first inlet to the right of the left inlet. |
void addint | ( | method | f | ) |
Use addint() to bind a function to the int message received in the leftmost inlet.
f | Function to be the int method. |
void addinx | ( | method | f, | |
short | n | |||
) |
Use addinx() to bind a function to a int message that will be received in an inlet other than the leftmost one.
f | Function to be the int method. | |
n | Number of the inlet connected to this method. 1 is the first inlet to the right of the left inlet. |
void addmess | ( | method | f, | |
char * | s, | |||
short | type, | |||
... | ||||
) |
Use addmess() to bind a function to a message other than the standard ones covered by addbang(), addint(), etc.
f | Function you want to be the method. | |
s | C string defining the message. | |
type | The first of one or more integers from e_max_atomtypes specifying the arguments to the message. | |
... | Any additional types from e_max_atomtypes for additonal arguments. |
Referenced by max_addmethod_defer(), max_addmethod_defer_low(), max_addmethod_usurp(), max_addmethod_usurp_low(), max_jit_classex_addattr(), max_jit_classex_mop_wrap(), max_jit_classex_setup(), max_jit_classex_standard_wrap(), and max_ob3d_setup().
void alias | ( | char * | name | ) |
Use the alias function to allow users to refer to your object by a name other than that of your shared library.
name | An alternative name for the user to use to make an object of your class. |
void class_setname | ( | char * | obname, | |
char * | filename | |||
) |
Use class_setname() to associate you object’s name with it’s filename on disk.
obname | A character string with the name of your object class as it appears in Max. | |
filename | A character string with the name of your external’s file as it appears on disk. |
Use egetfn() to send an untyped message to a Max object that always works.
op | Receiver of the message. | |
msg | Message selector. |
void freeobject | ( | t_object * | op | ) |
Release the memory used by a Max object.
freeobject() calls an object’s free function, if any, then disposes the memory used by the object itself. freeobject() should be used on any instance of a standard Max object data structure, with the exception of Qelems and Atombufs. Clocks, Binbufs, Proxies, Exprs, etc. should be freed with freeobject().
op | The object instance pointer to free. |
Referenced by jit_qt_record_new(), max_jit_obex_gimmeback(), and max_jit_obex_gimmeback_dumpout().
Use getfn() to send an untyped message to a Max object with error checking.
op | Receiver of the message. | |
msg | Message selector. |
Make a new instance of an existing Max class.
s | className Symbol specifying the name of the class of the instance to be created. | |
argc | Count of arguments in argv. | |
argv | Array of t_atoms; arguments to the class’s instance creation function. |
This function is useful for taking advantage of other already-defined objects that you would like to use “privately” in your object, such as tables. See the source code for the coll object for an example of using a privately defined class.
void* newobject | ( | void * | maxclass | ) |
Use newobject to allocate the space for an instance of your class and initialize its object header.
maxclass | The global class variable initialized in your main routine by the setup function. |
Referenced by max_jit_obex_new().
void setup | ( | t_messlist ** | ident, | |
method | makefun, | |||
method | freefun, | |||
short | size, | |||
method | menufun, | |||
short | type, | |||
... | ||||
) |
Use the setup() function to initialize your class by informing Max of its size, the name of your functions that create and destroy instances, and the types of arguments passed to the instance creation function.
ident | A global variable in your code that points to the initialized class. | |
makefun | Your instance creation function. | |
freefun | Your instance free function (see Chapter 7). | |
size | The size of your objects data structure in bytes. Usually you use the C sizeof operator here. | |
menufun | No longer used. You should pass NULL for this parameter. | |
type | The first of a list of arguments passed to makefun when an object is created. | |
... | Any additional arguments passed to makefun when an object is created. Together with the type parameter, this creates a standard Max type list as enumerated in e_max_atomtypes. The final argument of the type list should be a 0. |
Send a typed message directly to a Max object.
op | Max object that will receive the message. | |
msg | The message selector. | |
argc | Count of message arguments in argv. | |
argp | Array of t_atoms; the message arguments. |
Example:
//If you want to send a bang message to the object bang_me… void *bangResult; bangResult = typedmess(bang_me,gensym("bang"),0,0L);
Referenced by max_jit_mop_bang(), and max_ob3d_bang().
Use zgetfn() to send an untyped message to a Max object without error checking.
op | Receiver of the message. | |
msg | Message selector. |
Referenced by max_jit_attr_getdump().