Classes


Last modified: 2013-2-27

Class max

//TODO update returnvalues of functions/messages...
The Max object can be accessed as a property of a jsthis object. Any message you can send to the max object using the semicolon notation in a message box can be invoked within Javascript using Javascript syntax. For example, the following in a message box:

; max preempt 1
This can be expressed in Javascript as:
max.preempt(1);
For a list of current messages that can be sent to the Max object, refer to the Messages to Max topic.

Max in Cycling '74 Reference: Max Object and Cycling '74 Reference: Messages to Max

Class Summary
Constructor Attributes Constructor Name and Description
<private>  
max()
No Constructor.
Field Summary
Field Attributes Field Name and Description
String get 
The pathname of the Max application
Boolean get 
1 if the command (Macintosh) or control (Windows) key is currently held down
Boolean get 
1 if the control key is currently held down
max.db 
db
Patcher get 
The Patcher object of the frontmost patcher window, or a nil value if no patcher window is visible.
Boolean get 
1 if the js object is within a plug-in; note that this would be 1 if the js object was within a plug-in loaded into the vst~ object in Max.
Boolean get 
1 if the currently executing Max application environment does not allow editing, 0 if it does.
Boolean get 
1 if the user has disabled loadbang for the currently loading patch.
Boolean get 
1 if the option (Macintosh) or alt (Windows) key is currently held down
String get 
os
The name of the platform (e.g.
String get 
The current OS version number.
Boolean get 
1 if the shift key is currently held down
Float get 
The current scheduler time in milliseconds - will be a floating-point value.
String get 
The version of the Max application, in the following form: "451" Max Modifier Key Properties
Method Summary
Method Attributes Method Name and Description
void 
The word buildcollective, followed by a reference name symbol and an output filename, builds a collective using the patcher associated with the symbol.
void 
The word checkpreempt, followed by a symbol, sends the current Overdrive mode to the receive object named by the symbol.
void 
clean()
Causes Max not to show a Save Changes dialog when you close a window or quit, even if there are windows that have been modified.
void 
The word closefile, followed by a symbol, closes the patcher file previously opened with the openfile message to Max associated with the symbol.
void 
debug()
The word debug, followed by a zero or one, toggles the sending of Max's internal debugging output to the Max window.
void 
The word enablepathcache, followed by a zero or one, turns on (or off) Max's search path cache.
void 
(Macintosh only) The word enablerefresh, followed by a zero or one, toggles an alternative to the standard way in which the screen contents are updated, resulting in better visual performance.
void 
List all of the external objects currently loaded in the Max window.
void 
The word fileformat, followed by two symbols that specify a file extension and a four-character file type, tells Max to associate a filename extension with a particular filetype.
void 
The word fixwidthratio, followed by a floating-point number, sets the ratio of the box to the width of the text when the user chooses Fix Width from the Object menu.
void 
The word getdefaultpatcherheight followed by a symbol used as the name of a receive object, causes Max to report the current default patcher height in pixels to the named receive object (See also the setdefaultpatcherheight message to Max.
void 
The word getdefaultpatcherwidth, followed by a symbol used as the name of a receive object, causes Max to report the current default patcher width in pixels to the named receive object (See also the setdefaultpatcherwidth message to Max.
void 
The word getenablepathcache, followed by a symbol used as the name of a receive object, will report whether the path cache is enabled to the named receive object.
void 
(Macintosh only.
void 
The word geteventinterval, followed by a symbol used as the name of a receive object, will report the event interval to the named receive object.
void 
The word getfixwidthratio, followed by a symbol used as the name of a receive object, reports the current fix with ratio value to the named receive object.
void 
The word getpollthrottle, followed by a symbol used as the name of a receive object, reports the current poll throttle value to the named receive object.
void 
The word getqueuethrottle, followed by a symbol used as the name of a receive object, causes Max to report the current queue throttle value to the named receive object.
void 
(Macintosh only) The word getrefreshrate, followed by a symbol used as the name of a receive object, causes Max to report the current refresh rate in Hertz to the named receive object.
void 
The word getruntime, followed by a symbol used as the name of a receive object,sends a 1 to the named receive object if the current version of Max is a runtime version, and a 0 if not.
void 
The word getsleep, followed by a symbol used as the name of a receive object, causes Max to report the sleep time to the named receive object.
void 
The word getslop, followed by a symbol used as the name of a receive object, reports the scheduler slop value to the named receive object.
void 
The word getqueuethrottle, followed by a symbol used as the name of a receive object, reports the maximum number of patcher UI update events processed at a time to the named receive object.
void 
The word getsystem, followed by a symbol used as the name of a receive object, will report the name of the system (macintosh or windows) to the named receive object.
void 
The word getversion, followed by a symbol used as the name of a receive object, will report the Max version number (e.g.
void 
Hides the cursor if it is visible.
void 
Hides the menu bar.
void 
The word htmlref, followed by an object name as a symbol, looks for a file called .html in the search path.
void 
The word interval, followed by a number from 1 to 20, sets the timing interval of Max's internal scheduler in milliseconds.
void 
The word launchbrowser, followed by a URL as a symbol, opens a web browser to view the URL.
void 
The word maxcharheightforsubpixelantialiasing, followed by a number, sets a threshold font size (in points) for native subpixel aliasing.
void 
When using the runtime version of Max *and* an active custom menubar object, maxinwmenu, followed by the number 1, will place an item called Status in the Windows menu, allowing users to see the Max window (labeled Status in the runtime version).
void 
Displays the Max Window.
void 
midi()
The word midi, followed by a variable-length message, allows messages to be sent to configure the system MIDI object.
void 
Prints the names of all current MIDI devices in the Max window.
void 
The word nativetextrendering, followed by a zero or one, toggles between using JUCE font rendering (0) and the platform-native font rendering for your computer (1) when displaying text in Max.
void 
(Macintosh) The word notypeinfo, followed by zero or one, sets whether Max saves files with traditional Mac OS four-character type information.
void 
The word objectfile, followed by two symbols that specify an object name and a file name, creates a mapping between the external object and its filename.
void 
The word openfile, followed by two symbols that specify an reference name and a file name or path name, attempts to open the patcher with the specified name.
void 
paths()
List the current search paths in the Max window.
void 
portabbrev(portname)
innum specifies an input port, outnum specifies an output port, portname is the name of the port as a single symbol (i.e.
Boolean 
portenable(portname)
Enables (1) or disables (0) the port specified by portname.
void 
portoffset(portname)
Similar to portabbrev, but offset is the channel offset added to identify input or output ports when a MIDI object can send to or receive from multiple ports by channel number.
void 
preempt(mode)
The word preempt, followed by a one (on) or zero (off), toggles Overdrive mode.
void 
The word pupdate, followed by two integer values that specify horizontal and vertical position, moves the mouse cursor to that global location.
void 
quit()
Quits the Max application; equivalent to choosing Quit from the File menu.
void 
Causes all Max windows to be updated.
void 
(Macintosh only) The word setrefreshrate, followed by a number, sets the rate, in frames per second, at which the visual display is updated.
void 
The word runtime, followed by a zero or one and a message, executes the message if the current version of Max is a runtime version (1) or non-runtime (0).
void 
The word sendapppath, followed by a symbol, sends a symbol with the path of the Max application to the receive object named by the symbol.
void 
The word sendinterval, followed by a symbol, sends the current scheduler interval to the receive object named by the symbol.
void 
The word setdefaultpatcherheight, followed by an integer value greater than 100, sets the default patcher height in pixels.
void 
The word setdefaultpatcherwidth, followed by an integer value greater than 100, sets the default patcher width in pixels.
void 
The word seteventinterval, followed by an integer value, sets the time between invocations of the event-level timer (The default value is 2 milliseconds).
void 
The word setmirrortoconsole, followed by a 1 or 0, turns on or off (default is 0, off) mirroring of Max window posts to the system console.
void 
The word setpollthrottle, followed by an integer, sets the maximum number of events the scheduler executes each time it is called (The default value is 20).
void 
The word setqueuethrottle, followed by an integer value, sets the maximum number of events handled at low-priority each time the low-priority queue handler is called (The default value is 2).
void 
The word setsleep, followed by a number, sets the time between calls to get the next system event, in 60ths of a second.
void 
The word setslop, followed by a floating-point value, sets the scheduler slop value - the amount of time a scheduled event can be earlier than the current time before the time of the event is adjusted to match the current time.
void 
The word setsysqelemthrottle, followed by a number, sets the maximum number of patcher UI update events to process at a time.
void 
Shows the cursor if it is hidden.
void 
Shows the menu bar after it has been hidden with hidemenubar.
void 
size()
Prints the number of symbols in the symbol table in the Max window.
void 
system()
The word system, followed by the name of an Operating System (windows or macintosh) and a message, will execute the message if Max is running on the named OS.
void 
The word useslowbutcompletesearching, followed by a one (on) or zero (off), toggles complete file searching.
Class Detail
<private>

max

()
No Constructor. Property of jsthis/jsui.
Field Detail
{String get}

appath

The pathname of the Max application

{Boolean get}

cmdkeydown

1 if the command (Macintosh) or control (Windows) key is currently held down

{Boolean get}

ctrlkeydown

1 if the control key is currently held down

{max.db}

db


{Patcher get}

frontpatcher

The Patcher object of the frontmost patcher window, or a nil value if no patcher window is visible. You can traverse the list of open patcher windows with the next property of a Wind object.

{Boolean get}

isplugin

1 if the js object is within a plug-in; note that this would be 1 if the js object was within a plug-in loaded into the vst~ object in Max.

{Boolean get}

isruntime

1 if the currently executing Max application environment does not allow editing, 0 if it does.

{Boolean get}

loadbangdisabled

1 if the user has disabled loadbang for the currently loading patch. If your object implements a loadbang method, it can test this property and choose to do nothing if it is true.

{Boolean get}

optionkeydown

1 if the option (Macintosh) or alt (Windows) key is currently held down

{String get}

os

The name of the platform (e.g., “windows” or “macintosh”)

{String get}

osversion

The current OS version number.

{Boolean get}

shiftkeydown

1 if the shift key is currently held down

{Float get}

time

The current scheduler time in milliseconds - will be a floating-point value.

{String get}

version

The version of the Max application, in the following form: "451" Max Modifier Key Properties
Method Detail
{void}

buildcollective

()
The word buildcollective, followed by a reference name symbol and an output filename, builds a collective using the patcher associated with the symbol. The collective is named with the output filename.

{void}

checkpreempt

()
The word checkpreempt, followed by a symbol, sends the current Overdrive mode to the receive object named by the symbol.

{void}

clean

()
Causes Max not to show a Save Changes dialog when you close a window or quit, even if there are windows that have been modified. This is useful in conjunction with the quit message below.

{void}

closefile

()
The word closefile, followed by a symbol, closes the patcher file previously opened with the openfile message to Max associated with the symbol.

{void}

debug

()
The word debug, followed by a zero or one, toggles the sending of Max's internal debugging output to the Max window. Debug information may be of limited use for anyone who isn't debugging Max itself.

{void}

enablepathcache

()
The word enablepathcache, followed by a zero or one, turns on (or off) Max's search path cache. This should only be done if you noticed unusual behavior when opening files.

{void}

enablerefresh

()
(Macintosh only) The word enablerefresh, followed by a zero or one, toggles an alternative to the standard way in which the screen contents are updated, resulting in better visual performance. This feature is enabled by default. The rate at which refresh is done can be set by using the setrefreshrate message.

{void}

externs

()
List all of the external objects currently loaded in the Max window.

{void}

fileformat

()
The word fileformat, followed by two symbols that specify a file extension and a four-character file type, tells Max to associate a filename extension with a particular filetype. The message max fileformat .tx TEXT associates the extension .tx with TEXT (text) files. This allows a user to send a message read george and locate a file with the name george.tx. It also ensures that files with the extension .tx will appear in a standard open file dialog where text files can be chosen.

{void}

fixwidthratio

()
The word fixwidthratio, followed by a floating-point number, sets the ratio of the box to the width of the text when the user chooses Fix Width from the Object menu. The default value is 1.0. A value of 1.1 would make boxes wider than they needed to be, and a value of 0.9 would make boxes narrower than they need to be.

{void}

getdefaultpatcherheight

()
The word getdefaultpatcherheight followed by a symbol used as the name of a receive object, causes Max to report the current default patcher height in pixels to the named receive object (See also the setdefaultpatcherheight message to Max.)

{void}

getdefaultpatcherwidth

()
The word getdefaultpatcherwidth, followed by a symbol used as the name of a receive object, causes Max to report the current default patcher width in pixels to the named receive object (See also the setdefaultpatcherwidth message to Max.)

{void}

getenablepathcache

()
The word getenablepathcache, followed by a symbol used as the name of a receive object, will report whether the path cache is enabled to the named receive object. (See also the enablepathcache message to Max.)

{void}

getenablerefresh

()
(Macintosh only.) The word getenablerefresh, followed by a symbol used as the name of a receive object, will report whether enhanced refresh is enabled to the named receive object. (See also the enablerefresh message to Max.)

{void}

geteventinterval

()
The word geteventinterval, followed by a symbol used as the name of a receive object, will report the event interval to the named receive object. (See also the seteventinterval message to Max.)

{void}

getfixwidthratio

()
The word getfixwidthratio, followed by a symbol used as the name of a receive object, reports the current fix with ratio value to the named receive object. (See also the fixwidthratio message to Max.)

{void}

getpollthrottle

()
The word getpollthrottle, followed by a symbol used as the name of a receive object, reports the current poll throttle value to the named receive object. (See also the setpollthrottle message to Max.)

{void}

getqueuethrottle

()
The word getqueuethrottle, followed by a symbol used as the name of a receive object, causes Max to report the current queue throttle value to the named receive object. (See also the setqueuethrottle message to Max.)

{void}

getrefreshrate

()
(Macintosh only) The word getrefreshrate, followed by a symbol used as the name of a receive object, causes Max to report the current refresh rate in Hertz to the named receive object. (See also the setrefreshrate message to Max.)

{void}

getruntime

()
The word getruntime, followed by a symbol used as the name of a receive object,sends a 1 to the named receive object if the current version of Max is a runtime version, and a 0 if not.

{void}

getsleep

()
The word getsleep, followed by a symbol used as the name of a receive object, causes Max to report the sleep time to the named receive object. (See also the setsleep message to Max.)

{void}

getslop

()
The word getslop, followed by a symbol used as the name of a receive object, reports the scheduler slop value to the named receive object. (See also the setslop message to Max.)

{void}

getsysqelemthrottle

()
The word getqueuethrottle, followed by a symbol used as the name of a receive object, reports the maximum number of patcher UI update events processed at a time to the named receive object. (See also the setsysqelemthrottle message to Max.)

{void}

getsystem

()
The word getsystem, followed by a symbol used as the name of a receive object, will report the name of the system (macintosh or windows) to the named receive object.

{void}

getversion

()
The word getversion, followed by a symbol used as the name of a receive object, will report the Max version number (e.g. 6.1.3 is reported as 1300) to the named receive object.

{void}

hidecursor

()
Hides the cursor if it is visible.

{void}

hidemenubar

()
Hides the menu bar. Although the pull-down menus are not available when the menu bar is hidden, menu shortcut (accelerator) keys continue to work.

{void}

htmlref

()
The word htmlref, followed by an object name as a symbol, looks for a file called .html in the search path. If found, a web browser is opened to view the page.

{void}

interval

()
The word interval, followed by a number from 1 to 20, sets the timing interval of Max's internal scheduler in milliseconds. The default value is 1. This message only affects the scheduler when Overdrive is on and scheduler in audio interrupt (available with MSP) is off. (When using scheduler in audio interrupt mode the signal vector size determines the scheduler interval.) Larger scheduler intervals can improve CPU efficiency on slower computer models at the expense of timing accuracy.

{void}

launchbrowser

()
The word launchbrowser, followed by a URL as a symbol, opens a web browser to view the URL. For example:
Example:
//TODO test it
max.launchbrowser("http://www.cycling74.com");

{void}

maxcharheightforsubpixelantialiasing

()
The word maxcharheightforsubpixelantialiasing, followed by a number, sets a threshold font size (in points) for native subpixel aliasing. Since the look of subpixel antialiasing may be undesirable when working with large fonts as compared to regular antialiasing, this attribute lets you specify a threshold font size; if a font is larger than the specified size, it will be rendered using regular rather than subpixel antialiasing.

Note that Max honors your computer's system preferences - Max won't use subpixel aliasing if you've disabled it for your system. Setting this attribute value to zero value is 0 will always use regular antialiasing, and setting a very high value will always use subpixel antialiasing (unless it is disabled in system preferences).

{void}

maxinwmenu

()
When using the runtime version of Max *and* an active custom menubar object, maxinwmenu, followed by the number 1, will place an item called Status in the Windows menu, allowing users to see the Max window (labeled Status in the runtime version). When maxinwmenu is followed by 0 the menu item is not present. The default is for the Status item to be present in the Windows menu

{void}

maxwindow

()
Displays the Max Window. If the Max window if not currently open, the window will be displayed. If the window is currently open, it will bring it to the front.

{void}

midi

()
The word midi, followed by a variable-length message, allows messages to be sent to configure the system MIDI object. The following is a list of the available options:

{void}

midilist

()
Prints the names of all current MIDI devices in the Max window. (See also MIDI Messages to Max, above.)

{void}

nativetextrendering

()
The word nativetextrendering, followed by a zero or one, toggles between using JUCE font rendering (0) and the platform-native font rendering for your computer (1) when displaying text in Max.

{void}

notypeinfo

()
(Macintosh) The word notypeinfo, followed by zero or one, sets whether Max saves files with traditional Mac OS four-character type information. By default, Max does save this information in files.

{void}

objectfile

()
The word objectfile, followed by two symbols that specify an object name and a file name, creates a mapping between the external object and its filename. For example, the *~ object is in a file called times~ so at startup Max executes the command max objectfile *~ times~.

{void}

openfile

()
The word openfile, followed by two symbols that specify an reference name and a file name or path name, attempts to open the patcher with the specified name. If successful, the patcher is associated with the reference symbol, which can be passed as argument to the buildcollective, buildplugin, and closefile messages to Max. The openfile message is intended for batch collective building.

{void}

paths

()
List the current search paths in the Max window. There is a button in the File Preferences window that does this.

{void}

portabbrev

(portname)
innum specifies an input port, outnum specifies an output port, portname is the name of the port as a single symbol (i.e. It is necessary to use double quotes). An abbrev value is 0 for no abbrev (- in menu), 1 for 'a' and 26 for 'z'.
Parameters:
portname
 

{Boolean}

portenable

(portname)
Enables (1) or disables (0) the port specified by portname. All ports are enabled by default.
Parameters:
portname
 

{void}

portoffset

(portname)
Similar to portabbrev, but offset is the channel offset added to identify input or output ports when a MIDI object can send to or receive from multiple ports by channel number. Must be a multiple of 16 (e.g. max midi portoffset innum PortA 16 sets the channel offset for PortA device to 16).
Parameters:
portname
 

{void}

preempt

(mode)
The word preempt, followed by a one (on) or zero (off), toggles Overdrive mode.
Parameters:
{Boolean} mode
 

{void}

pupdate

()
The word pupdate, followed by two integer values that specify horizontal and vertical position, moves the mouse cursor to that global location.

{void}

quit

()
Quits the Max application; equivalent to choosing Quit from the File menu. If there are unsaved changes to open files, and you haven't sent Max the clean message, Max will ask whether to save changes.

{void}

refresh

()
Causes all Max windows to be updated.

{void}

refreshrate

()
(Macintosh only) The word setrefreshrate, followed by a number, sets the rate, in frames per second, at which the visual display is updated. On Macintosh systems, the rate at which the screen is refreshed is unrelated to the rate at which you change its contents. Better visual performance can be achieved - at the cost of a slight performance decrease in Jitter, and little or no performance decrease for audio processing - by specifying a higher frame rate. When enabled using the enablerefresh 1 message, the default rate is 28.57 FPS. Refresh enable is off by default.

{void}

runtime

()
The word runtime, followed by a zero or one and a message, executes the message if the current version of Max is a runtime version (1) or non-runtime (0).

{void}

sendapppath

()
The word sendapppath, followed by a symbol, sends a symbol with the path of the Max application to the receive object named by the symbol.

{void}

sendinterval

()
The word sendinterval, followed by a symbol, sends the current scheduler interval to the receive object named by the symbol.

{void}

setdefaultpatcherheight

()
The word setdefaultpatcherheight, followed by an integer value greater than 100, sets the default patcher height in pixels.

{void}

setdefaultpatcherwidth

()
The word setdefaultpatcherwidth, followed by an integer value greater than 100, sets the default patcher width in pixels.

{void}

seteventinterval

()
The word seteventinterval, followed by an integer value, sets the time between invocations of the event-level timer (The default value is 2 milliseconds). The event-level timer handles low priority tasks like drawing user interface updates and playing movies.

{void}

setmirrortoconsole

()
The word setmirrortoconsole, followed by a 1 or 0, turns on or off (default is 0, off) mirroring of Max window posts to the system console. The system console is available on the Mac using Console.app, or on Windows using the DbgView program (free download from Microsoft).

{void}

setpollthrottle

()
The word setpollthrottle, followed by an integer, sets the maximum number of events the scheduler executes each time it is called (The default value is 20). Setting this value lower may decrease accuracy of timing at the expense of efficiency.

{void}

setqueuethrottle

()
The word setqueuethrottle, followed by an integer value, sets the maximum number of events handled at low-priority each time the low-priority queue handler is called (The default value is 2). Changing this value may affect the responsiveness of the user interface.

{void}

setsleep

()
The word setsleep, followed by a number, sets the time between calls to get the next system event, in 60ths of a second. The default value is 2.

{void}

setslop

()
The word setslop, followed by a floating-point value, sets the scheduler slop value - the amount of time a scheduled event can be earlier than the current time before the time of the event is adjusted to match the current time. The default value is 25 milliseconds.

{void}

setsysqelemthrottle

()
The word setsysqelemthrottle, followed by a number, sets the maximum number of patcher UI update events to process at a time. Lower values can lead to more processing power available to other low-priority Max processes, and higher values make the user interface more responsive (especially when using many bpatchers).

{void}

showcursor

()
Shows the cursor if it is hidden.

{void}

showmenubar

()
Shows the menu bar after it has been hidden with hidemenubar.

{void}

size

()
Prints the number of symbols in the symbol table in the Max window.

{void}

system

()
The word system, followed by the name of an Operating System (windows or macintosh) and a message, will execute the message if Max is running on the named OS.

{void}

useslowbutcompletesearching

()
The word useslowbutcompletesearching, followed by a one (on) or zero (off), toggles complete file searching. When enabled, it causes files not found in Max's cache of the search path to be searched in the file system. This is necessary only in extremely rare cases where the file cache does not update properly. One such case is copying a file into the search path using a version of the Mac OS prior to 10.5.5 over a network. This option may cause patcher files to be loaded more slowly. The setting defaults to off with each launch of the application, and is not stored in the user's preferences. useslowbutcompletesearching 0 turns the setting off.

©2012-2013
Max MSP Documentation copied to JsDoc by Tim Schenk SEO Frelancer Berlin. Some examples are by him. Some descriptions of classes, interfaces, properties, methods or events are by him. Until now, most of it is a copy. Published with permission of Cycling '74. This document might be wrong or incomplete. All informations without any warranty. All trademarks are the property of their respective owners. Documentation generated by JsDoc Toolkit on 2013-2-27