Inlets and Outlets
[Classes]
Routines for creating and communicating with inlets and outlets.
More...
Functions |
void * | inlet_new (void *x, char *s) |
| Use inlet_new() to create an inlet that can receive a specific message or any message.
|
void * | intin (void *x, short n) |
| Use intin() to create an inlet typed to receive only integers.
|
void * | floatin (void *x, short n) |
| Use floatin() to create an inlet typed to receive only floats.
|
void * | outlet_new (void *x, char *s) |
| Use outlet_new() to create an outlet that can send a specific non-standard message, or any message.
|
void * | bangout (void *x) |
| Use bangout() to create an outlet that will always send the bang message.
|
void * | intout (void *x) |
| Use intout() to create an outlet that will always send the int message.
|
void * | floatout (void *x) |
| Use floatout() to create an outlet that will always send the float message.
|
void * | listout (void *x) |
| Use listout() to create an outlet that will always send the list message.
|
void * | outlet_bang (void *o) |
| Use outlet_bang() to send a bang message out an outlet.
|
void * | outlet_int (void *o, long n) |
| Use outlet_int() to send a float message out an outlet.
|
void * | outlet_float (void *o, double f) |
| Use outlet_float() to send an int message out an outlet.
|
void * | outlet_list (void *o, t_symbol *s, short ac, t_atom *av) |
| Use outlet_list() to send a list message out an outlet.
|
void * | outlet_anything (void *o, t_symbol *s, short ac, t_atom *av) |
| Use outlet_anything() to send any message out an outlet.
|
void * | proxy_new (void *x, long id, long *stuffloc) |
| Use proxy_new to create a new Proxy object.
|
long | proxy_getinlet (t_object *master) |
| Use proxy_getinlet to get the inlet number in which a message was received.
|
Detailed Description
Routines for creating and communicating with inlets and outlets.
Function Documentation
void* bangout |
( |
void * |
x |
) |
|
Use bangout() to create an outlet that will always send the bang message.
- Parameters:
-
- Returns:
- A pointer to the new outlet.
void* floatin |
( |
void * |
x, |
|
|
short |
n | |
|
) |
| | |
Use floatin() to create an inlet typed to receive only floats.
- Parameters:
-
| x | Your object. |
| n | Location of the inlet from 1 to 9. 1 is immediately to the right of the leftmost inlet. |
- Returns:
- A pointer to the new inlet.
void* floatout |
( |
void * |
x |
) |
|
Use floatout() to create an outlet that will always send the float message.
- Parameters:
-
- Returns:
- A pointer to the new outlet.
void* inlet_new |
( |
void * |
x, |
|
|
char * |
s | |
|
) |
| | |
Use inlet_new() to create an inlet that can receive a specific message or any message.
- Parameters:
-
| x | Your object. |
| s | Character string of the message, or NULL to receive any message. |
- Returns:
- A pointer to the new inlet.
void* intin |
( |
void * |
x, |
|
|
short |
n | |
|
) |
| | |
Use intin() to create an inlet typed to receive only integers.
- Parameters:
-
| x | Your object. |
| n | Location of the inlet from 1 to 9. 1 is immediately to the right of the leftmost inlet. |
- Returns:
- A pointer to the new inlet.
The order you create additional inlets is important. If you want the rightmost inlet to be the have the highest number in- or ft- message (which is usually the case), you should create the highest number message inlet first.
void* intout |
( |
void * |
x |
) |
|
Use intout() to create an outlet that will always send the int message.
- Parameters:
-
- Returns:
- A pointer to the new outlet.
void* listout |
( |
void * |
x |
) |
|
Use listout() to create an outlet that will always send the list message.
- Parameters:
-
- Returns:
- A pointer to the new outlet.
void* outlet_anything |
( |
void * |
o, |
|
|
t_symbol * |
s, |
|
|
short |
ac, |
|
|
t_atom * |
av | |
|
) |
| | |
Use outlet_anything() to send any message out an outlet.
- Parameters:
-
| o | Outlet that will send the message. |
| s | The message selector t_symbol*. |
| ac | Number of elements in the list in argv. |
| av | Atoms constituting the list. |
- Returns:
- Returns 0 if a stack overflow occurred, otherwise returns 1.
First, here’s a hard way to send the bang message (see outlet_bang() for an easier way):
If you’ll be sending the same message a lot, you might call gensym() on the message string at initialization time and store the result in a global variable to save the (significant) overhead of calling gensym() every time you want to send a message.
Also, do not send lists using outlet_anything() with list as the selector argument. Use the outlet_list() function instead.
Referenced by max_jit_mop_jit_matrix(), max_jit_mop_outputmatrix(), and max_jit_obex_dumpout().
void* outlet_bang |
( |
void * |
o |
) |
|
Use outlet_bang() to send a bang message out an outlet.
- Parameters:
-
| o | Outlet that will send the message. |
- Returns:
- Returns 0 if a stack overflow occurred, otherwise returns 1.
void* outlet_float |
( |
void * |
o, |
|
|
double |
f | |
|
) |
| | |
Use outlet_float() to send an int message out an outlet.
- Parameters:
-
| o | Outlet that will send the message. |
| f | Float value to send. |
- Returns:
- Returns 0 if a stack overflow occurred, otherwise returns 1.
void* outlet_int |
( |
void * |
o, |
|
|
long |
n | |
|
) |
| | |
Use outlet_int() to send a float message out an outlet.
- Parameters:
-
| o | Outlet that will send the message. |
| n | Integer value to send. |
- Returns:
- Returns 0 if a stack overflow occurred, otherwise returns 1.
Use outlet_list() to send a list message out an outlet.
- Parameters:
-
| o | Outlet that will send the message. |
| s | Should be NULL, but can be the _sym_list. |
| ac | Number of elements in the list in argv. |
| av | Atoms constituting the list. |
- Returns:
- Returns 0 if a stack overflow occurred, otherwise returns 1.
Here’s an example of sending a list of three numbers.
t_atom myList[3];
long theNumbers[3];
short i;
theNumbers[0] = 23;
theNumbers[1] = 12;
theNumbers[2] = 5;
for (i=0; i < 3; i++) {
atom_setlong(myList+i,theNumbers[i]);
}
outlet_list(myOutlet,0L,3,&myList);
void* outlet_new |
( |
void * |
x, |
|
|
char * |
s | |
|
) |
| | |
Use outlet_new() to create an outlet that can send a specific non-standard message, or any message.
- Parameters:
-
| x | Your object. |
| s | A C-string specifying the message that will be sent out this outlet, or NULL to indicate the outlet will be used to send various messages. The advantage of this kind of outlet’s flexibility is balanced by the fact that Max must perform a message-lookup in real-time for every message sent through it, rather than when a patch is being constructed, as is true for other types of outlets. Patchers execute faster when outlets are typed, since the message lookup can be done before the program executes. |
- Returns:
- A pointer to the new outlet.
Referenced by max_jit_mop_matrixout_new(), and max_jit_mop_setup_simple().
long proxy_getinlet |
( |
t_object * |
master |
) |
|
Use proxy_getinlet to get the inlet number in which a message was received.
Note that the “owner” argument should point to your external object’s instance, not a proxy object.
- Parameters:
-
- Returns:
- The index number of the inlet that received the message.
Referenced by max_jit_obex_inletnumber_get().
void* proxy_new |
( |
void * |
x, |
|
|
long |
id, |
|
|
long * |
stuffloc | |
|
) |
| | |
Use proxy_new to create a new Proxy object.
- Parameters:
-
| x | Your object. |
| id | A non-zero number to be written into your object when a message is received in this particular Proxy. Normally, id will be the inlet “number” analogous to in1, in2 etc. |
| stuffloc | A pointer to a location where the id value will be written. |
- Returns:
- A pointer to the new proxy inlet.
After your method has finished, Proxy sets the stuffLoc location back to 0, since it never sees messages coming in an object’s leftmost inlet. You’ll know you received a message in the leftmost inlet if the contents of stuffLoc is 0. As of Max 4.3, stuffLoc is not always guaranteed to be a correct indicator of the inlet in which a message was received. Use proxy_getinlet() to determine the inlet number.
Referenced by max_jit_obex_proxy_new().