Max 5 API Reference

Console
[Miscellaneous]

Collaboration diagram for Console:

Functions

void post (char *fmt,...)
 Print text to the Max window.
void cpost (char *fmt,...)
 Print text to the system console.
void error (char *fmt,...)
 Print an error to the Max window.
void ouchstring (char *s,...)
 Put up an error or advisory alert box on the screen.
void postatom (t_atom *ap)
 Print multiple items in the same line of text in the Max window.
void object_post (t_object *x, char *s,...)
 Print text to the Max window, linked to an instance of your object.
void object_error (t_object *x, char *s,...)
 Print text to the Max window, linked to an instance of your object, and flagged as an error (highlighted with a red background).
void object_warn (t_object *x, char *s,...)
 Print text to the Max window, linked to an instance of your object, and flagged as a warning (highlighted with a yellow background).
void object_error_obtrusive (t_object *x, char *s,...)
 Print text to the Max window, linked to an instance of your object, and flagged as an error (highlighted with a red background), and grab the user's attention by displaying a banner in the patcher window.

Function Documentation

void cpost ( char *  fmt,
  ... 
)

Print text to the system console.

On the Mac this post will be visible by launching Console.app in the /Applications/Utilities folder. On Windows this post will be visible by launching the dbgView.exe program, which is a free download as a part of Microsoft's SysInternals.

Parameters:
fmt A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
Remarks:
Particularly on MacOS 10.5, posting to Console.app can be a computationally expensive operation. Use with care.
See also:
post()
object_post()
void error ( char *  fmt,
  ... 
)

Print an error to the Max window.

Max 5 introduced object_error(), which provides several enhancements to error() where a valid t_object pointer is available.

error() is very similar to post(), thought it offers two additional features:

  • the post to the Max window is highlighted (with a red background).
  • the post can be trapped with the error object in a patcher.
Parameters:
fmt A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
See also:
object_post()
post()
cpost()
void object_error ( t_object x,
char *  s,
  ... 
)

Print text to the Max window, linked to an instance of your object, and flagged as an error (highlighted with a red background).

Max window rows which are generated using object_post() or object_error() can be double-clicked by the user to have Max assist with locating the object in a patcher. Rows created with object_post() and object_error() will also automatically provide the name of the object's class in the correct column in the Max window.

Parameters:
x A pointer to your object.
s A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
See also:
object_post()
object_warn()
void object_error_obtrusive ( t_object x,
char *  s,
  ... 
)

Print text to the Max window, linked to an instance of your object, and flagged as an error (highlighted with a red background), and grab the user's attention by displaying a banner in the patcher window.

This function should be used exceedingly sparingly, with preference given to object_error() when a problem occurs.

Parameters:
x A pointer to your object.
s A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
See also:
object_post()
object_error()
void object_post ( t_object x,
char *  s,
  ... 
)

Print text to the Max window, linked to an instance of your object.

Max window rows which are generated using object_post() or object_error() can be double-clicked by the user to have Max assist with locating the object in a patcher. Rows created with object_post() and object_error() will also automatically provide the name of the object's class in the correct column in the Max window.

Parameters:
x A pointer to your object.
s A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
Remarks:
Example:
    void myMethod(myObject *x, long someArgument)
    {
        object_post((t_object*)x, "This is my argument: %ld", someArgument);
    }
See also:
object_error()
void object_warn ( t_object x,
char *  s,
  ... 
)

Print text to the Max window, linked to an instance of your object, and flagged as a warning (highlighted with a yellow background).

Max window rows which are generated using object_post(), object_error(), or object_warn can be double-clicked by the user to have Max assist with locating the object in a patcher. Rows created with object_post(), object_error(), or object_warn() will also automatically provide the name of the object's class in the correct column in the Max window.

Parameters:
x A pointer to your object.
s A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
See also:
object_post()
object_error()
void ouchstring ( char *  s,
  ... 
)

Put up an error or advisory alert box on the screen.

Don't use this function. Instead use error(), object_error(), or object_error_obtrusive().

This function performs an sprintf() on fmtstring and items, then puts up an alert box. ouchstring() will queue the message to a lower priority level if it’s called in an interrupt and there is no alert box request already pending.

Parameters:
s A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
See also:
error()
object_error()
object_error_obtrusive()
void post ( char *  fmt,
  ... 
)

Print text to the Max window.

Max 5 introduced object_post(), which provides several enhancements to post() where a valid t_object pointer is available.

post() is a printf() for the Max window. It even works from non-main threads, queuing up multiple lines of text to be printed when the main thread processing resumes. post() can be quite useful in debugging your external object.

Parameters:
fmt A C-string containing text and printf-like codes specifying the sizes and formatting of the additional arguments.
... Arguments of any type that correspond to the format codes in fmtString.
Remarks:
Note that post only passes 16 bytes of arguments to sprintf, so if you want additional formatted items on a single line, use postatom().

Example:

    short whatIsIt; 

    whatIsIt = 999; 
    post ("the variable is %ld",(long)whatIsIt); 
Remarks:
The Max Window output when this code is executed.
    the variable is 999
See also:
object_post()
error()
cpost()
void postatom ( t_atom ap  ) 

Print multiple items in the same line of text in the Max window.

This function prints a single t_atom on a line in the Max window without a carriage return afterwards, as post() does. Each t_atom printed is followed by a space character.

Parameters:
ap The address of a t_atom to print.
See also:
object_post()
post()
cpost()

Copyright © 2008, Cycling '74