pattr

Patcher-specific, named data wrapper

Description

The pattr object can be thought of as an alias for data. It functions in two modes. By default, the pattr object maintains its own data. This data can be of any normal Max type (int, float, list, symbol). The pattr object can also bind to another object, as long as that object has a patcher name that the pattr object can resolve. In this instance, the pattr object merely refers to the data inside of another object, and is restricted to the type of data expected by the object. When bound, data sent to the pattr object is forwarded to the referred object (target), and changes made to the target are reflected in the pattr object.

Arguments

Name Type Opt Description
name symbol opt A symbol argument may be optionally used to set the pattr object's name. In the absence of an argument (or the explicit setting of the name attribute using the @name syntax), the pattr object is given an arbitrary, semi-random name, such as u197000004.

Messages

bang Outputs the data maintained by the pattr object from the left outlet.
int input [int]
An int is stored inside the pattr object and output from its left outlet. Optionally, the value is passed along to a bound object. (See the bindto attribute for more information on bound objects).
float input [float]
A float is stored inside the pattr object and output from its left outlet. Optionally, the value is passed along to a bound object. (See the bindto attribute for more information on bound objects).
list input [list]
A list is stored inside the pattr object and output from its left outlet. Optionally, the value is passed along to a bound object. (See the bindto attribute for more information on bound objects).
anything input [list]
Any message is stored inside the pattr object and output from its left outlet. Optionally, the value is passed along to a bound object. (See the bindto attribute for more information on bound objects).
assign assign-input [float]
The word assign, followed by a floating point value, causes that value to be stored and displayed and sent out the pattr object's left outlet. If the object’s Parameter Enabled attribute is set (checked) and the Parameter Visibility attribute is set to Stored Only, the assign message will not add the new value to the Live application’s undo chain.
(mouse) Double-clicking on a pattr object that is parameter-enabled will open the Parameters Window in Max for Live.
init If the pattr object's initial attribute has been set, the init message will cause the pattr object's value to be set to value of the initial attribute.

Attributes

Name Type g/s Description
autorestore int Enables (1) or disables (0) the autorestore state of the pattr object. The default is 1 (enabled). When enabled, the pattr object will automatically output its last-saved value when the patcher is loaded (and, if bound to another object, send the value to that object. See the bindto attribute, below for more information on bound objects).
bindto symbol The word bindto, which may be followed by an optional symbol argument, sets the pattr object's binding state. The default state is unbound (no arguments). By default, the pattr object maintains its own data. When "bound" using the bindto feature, a pattr object maintains the data for the other object and automatically gets and sets values for that object. bindto takes an optional symbol argument, which specifies the name of the object to which pattr will bind. Binding targets need not be at the same patcher-level as the pattr object. In this case, a double-colon syntax ('::') is used to separate levels of patcher hierarchy for the purposes of describing a path for name resolution (e.g. somepatcher::someobject). If the named object is at a higher patcher-level than the pattr object, the word parent can be used to refer to a patcher at a higher level (e.g. parent::objectaboveme, parent::parent::objectaboveobjectaboveme or parent::patchernexttome::someobject ).

If the named object contains attributes, and the user wishes to bind to a specific attribute, the same double-colon syntax is used to specify the name of that attribute (e.g. someobject::someattribute). A bindto message sent without an argument unbinds the pattr object from any bound object, and causes it to resume the maintenance its own internal state. See the pattr helpfile for more information about this feature.
default_active int Enables (1) or disables (0) the pattr object's default active state, when it is discovered by a pattrstorage object. The default is 1 (active). See the Reference for the pattrstorage object for more information.
default_interp atom The word default_interp, followed by a symbol and an optional 2nd argument, defines the pattr object's default interpolation setting, when it is discovered by a pattrstorage object. The default is linear. See the Reference for the pattrstorage object for more information.
default_priority int The word default_interp, followed by an int, defines the pattr object's default priority, when it is discovered by a pattrstorage object. The default is 0. See the Reference for the pattrstorage object for more information.
dirty int Enables (1) or disables (0) the patcher-dirty flag. The default is 0 (disabled). When enabled, the pattr object will dirty the patch whenever its state changes.
initial atom
def.:
The pattr object's initial value. If autorestore is set to 1, this value will be restored upon patch load, rather than the value of the pattr object at the time the patch was last saved. The initial attribute can be used in combination with the init message to reset the pattr object to the specified value.
invisible int The word invisible, followed by a 1 or 0, determines whether or not the pattr object is invisible to pattrstorage objects. The default is 0 (visible).
parameter_enable int Enables parameter support.
thru int Enables (1) or disables (0) the pattr object's thru behavior. The default is 1 (enabled). When enabled, the object will output its value whenever it changes. When disabled, the object will only output its value when it receives a bang message.
type symbol The word type, followed by a symbol corresponding to a valid type, sets the data type maintained internally by the pattr object, when the object is not bound. The default is atom. Available types include char, long, float32, float64, symbol, and atom.

Information about attributes available for Parameter-aware objects

Information for box attributes common to all objects

Output

(internal): A user interface object (or other object that responds to the internal messaging system utilized by pattr) connected to the middle outlet of the pattr object will be automatically named (if necessary) and bound to. The name is automatically generated from the object's class name (e.g. a connected number box might be named number[1].) Currently, the following Max user interface objects can be bound in this fashion: dial, function, gain~, ggate, gswitch, js (requires user support), jsui (see the JavaScript in Max manual for more information on using the pattr system with JavaScript), led, matrixctrl, multislider, nslider, number box (int and float), pattr, pattrstorage, pictctrl, pictslider, radiogroup, rslider, slider, swatch, table, textedit, toggle, and umenu.
anything: Out left outlet: When the pattr object receives new data, a bang, or registers the change of the value of its bound object, this value is output.

Out right outlet: get queries to the pattr object's attributes are output from the right outlet, also known as the dumpout outlet.

Examples

See Also

Name Description
autopattr Expose multiple objects in a patcher to the pattr system
pattrforward Send any message to a named object in the patcher hierarchy
pattrhub Access all of the pattr objects in a patcher
pattrmarker Create pattr 'share points' and communicate between patcher hierarchies
pattrstorage Save and recall presets of pattr data
Max pattr Tutorial 1: Patcher Storage Max pattr Tutorial 1: Patcher Storage