pattrstorage
Description
View and modify client object data, and store or recall presets.
Examples
Discussion
Through the pattrstorage object, you can get/set any pattrstorage or autopattr data (a la pattrhub, although you can talk to any object exposed to pattr or autopattr, not just those in the same patch). Data may be recalled as an interpolated value between 2 stored values.
Arguments
name [symbol]
A symbol argument may be optionally used to set the pattrstorage object's scripting name. In the absence of an argument, the pattrstorage object is given an arbitrary, semi-random name, such as u197000004.
Attributes
activewritemode [int]
Sets the write mode for the active property of client objects. The default is 0 (disabled). When enabled, the active state of client objects will be saved with the XML preset data file and restored when this file is re-read.
autopattr_vis [int]
Sets the visibility of autopattr objects in the clientwindow and storagewindow displays. The default is 0 (disabled). Since autopattr objects are not used for forming path names, one can generally ignore them for the purposes of display. When performing pattrstorage object functions, such as setting the state or for an entire set of objects being exposed by a single autopattr object, the user needs to know the name of the objects' actual container object. Enabling may make this process somewhat clearer visually and conceptually.
autorestore [int]
Enables or disables the pattrstorage object's autorestore state. The default is 1 (on). When enabled, the pattrstorage object will automatically try to locate and read an XML file representing preset data when the patcher loads. The pattrstorage object will attempt to load the last-saved file. If the pattrstorage object in question has never saved a file, the object will attempt to load a file with the name (name).xml, where (name) is the patcher name of the pattrstorage object (usually, its argument).
autowatch [int]
Sets the pattrstorage object's file watching behavior. The default is 0 (disabled). When file watching is enabled, the most recently read or written XML data file will be reloaded automatically if it is modified. This allows you to use an external editor for your XML data file. When you save the file, the pattrstorage object will notice. Note that when the file is re-read, any currently unsaved data will be lost.
backupmode [int]
Sets the number of backup XML files to be maintained and rotated by the pattrstorage object when writing files. The default is 0 (disabled). The argument specifies the number of backups the pattrstorage object should make before the files start rotating (being automatically deleted to make room for new backups). The most recent backup is called pstoname.bak.xml. The next, pstoname_1.bak.xml, followed by pstoname_2.bak.xml, etc.
changemode [int]
Sets the pattrstorage object's data-filtration behavior. The default is 0 (disabled). When enabled, only changed values are sent from the pattrstorage object to client objects, and repeated data is filtered.
client_rect [4 floats] (default: 50. 50. 400. 500.)
Sets a new size and position for the client list window. The window position is specified in global coordinates by 4 numbers (left, top, right, bottom).
dirty [int]
Enables or disables the patcher-dirty flag. The default is 0 (disabled). When enabled, the pattrstorage object will dirty the patch whenever its state changes.
fileusagemode [int]
Enables or disables the inclusion of JSON/XML storage files in collectives and standalones. The default is 0 (include storage file).
flat [int]
Enables or disables the pattrstorage object's client list display flag. The default is 0 (disabled). When enabled, the pattrstorage object's 2 windows will not display a hierarchical view of clients, instead display only data-containing objects (no patchers), and their full path name or alias.
greedy [int]
Sets the pattrstorage object's client search behavior flag. The attribute provides a way to limit the amount of data a single pattrstorage object will manage. The following values are possible:
0 = disabled (the default). The pattrstorage object can see all pattr objects or objects bound to autopattr objects in any child patches of the pattrstorage object (or child patches of those child patches, tunneling down through the patcher hierarchy), until another pattrstorage object is found. Although the pattrstorage object found in a child patch will be a client of the parent pattrstorage object, no other objects at that level or below in the patcher hierarchy will be.
1 = see everything. When the attribute is set to 1, the pattrstorage object can see everything, all the way down to the bottom of the patcher hierarchy (including any pattrstorage objects it finds along the way).
2 = clients only. When the attribute is set to 2, the pattrstorage object can only see potential client objects in its patch. No other patches are searched.
notifymode [int]
Sets the pattrstorage object's add/remove-notification behavior. The default is 0 (disabled). When enabled, the pattrstorage object will send a message from it's outlet every time an object is added or removed from its client list, in the form . Note that the pattrstorage object must occasionally purge and fully rebuild its client list in response to certain events, resulting in significant output when is enabled and objects are being added and removed regularly.
outputmode [int]
Sets the pattrstorage object's auto-output behavior. The default is 0 (disabled). When enabled, the pattrstorage object will send a message from its outlet every time a value is sent to one of its client objects, in the form . The following modes are available:
0 = disabled
1 = output all values sent to client objects
2 = output only changed values sent to client objects (see changemode)
3 = output all values sent to client objects not initiated by a message to the pattrstorage object
4 = output only changed values sent to client objects not initiated by a message to the pattrstorage object (see changemode)
5 = output all values sent to client objects not initiated by a message to any pattr-system object (pattr, pattrhub, pattrforward, pattrstorage).
6 = output only changed values sent to client objects not initiated by a message to any pattr-system object (see changemode)
parameter_enable [int]
Enables use of this object with Max for Live Parameters.
savemode [int]
Sets the pattrstorage object's save behavior. The default is 1 (prompt on object free). In this mode, if the pattrstorage object's preset data has changed (presets have been stored, deleted or modified since the last file or operation) at the time the object is freed, the object will prompt the user to write a preset file. In mode 2, pattrstorage will attempt to autosave a preset file (without user interaction), whenever the patcher is saved. In mode 0, pattrstorage will neither prompt nor autosave. In mode 3, pattrstorage will attempt to autosave a preset file (without user interaction), whenever the patcher is freed.
The following values are possible:
0 = Neither prompt nor autosave
1 = Prompt the user to save a preset file when the object is freed (default)
2 = Attempt to autosave whenever the patcher is saved, or if unsuccessful, prompt the user to save a preset file
3 = Attempt to autosave (without user interaction) when the patcher is freed. Failing that, prompt the user
storage_rect [4 floats] (default: 600. 50. 400. 500.)
Sets a new size and position for the stored data window. The window position is specified in global coordinates by 4 numbers (left, top, right, bottom).
subscribemode [int]
Sets the subscription mode. The default is 0 (disabled). When enabled, the pattrstorage object uses a user-specified subscription list to determine which objects are clients, rather than discovering and maintaining all objects within the patcher/patcher hierarchy (as determined by the greedy attribute. The and messages can be used to add and remove objects to and from this list, and the message can be used to output a list of currently subscribed objects.
Common Box Attributes
annotation [symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background [int] (default: 0)
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.color [4 floats]
Sets the color for the object box outline.
fontface [int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname [symbol]
Sets the object's font.
fontsize [float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hidden [int] (default: 0)
Toggles whether an object is hidden when the patcher is locked.
hint [symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick [int] (default: 0)
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile [symbol]
JS Painter File
patching_rect [4 floats] (default: 0. 0. 100. 0.)
Sets the position and size of the object in the patcher window.
position [2 floats]
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation [int] (default: 0)
Sets whether an object belongs to the patcher's presentation.
presentation_rect [4 floats] (default: 0. 0. 0. 0.)
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect [4 floats]
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size [2 floats]
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor [4 floats]
Sets the color for the object's text in RGBA format.
textjustification [int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname [symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Parameter Attributes
Order
Sets the order of recall of this parameter. Lower numbers are recalled first. The order of recall of parameters with the same order number is undefined.
Parameter Mode Enable
Parameter Mode Enable (not available from Parameters window)
Link to Scripting Name
When checked, the Scripting Name is linked to the Long Name attribute.
Long Name
The long name of the parameter. This name must be unique per patcher hierarchy.
Short Name
Sets the short name for the object's visual display. The maximum length varies according to letter width, but is generally in a range of 5 to 7 characters.
Type
Specifies the data type. The data types used in Max for Live are:
Float
Int
Enum (enumerated list)
Blob
Note: By convention, the Live application uses floating point numbers
for its calculations; the native integer representation is limited to 256
values, with a default range of 0-255 (similar to the char data type used
in Jitter). When working with Live UI objects whose integer values will
exceed this range, the Type attribute should be set to Float,
and the Unit Style attribute should be set to Int.
Range/Enum
When used with an integer or floating point data type, this field is
used to specify the minimum and maximum values of the parameter.
When used with an enumerated list (Enum) data type, this field contains
a space-delimited list of the enumerated values (if list items contain a
space or special characters, the name should be enclosed in double
quotes).
Clip Modulation Mode
Sets the Clip Modulation Mode used by the Live application. The modulation
modes are:
None
Unipolar
Bipolar
Additive
Absolute
Clip Modulation Range
This parameter is only used with the Absolute modulation mode. It specifies defines the range of values used.
Initial Enable
When checked (set to 1), the UI object can store an initialization value. The value is set using the Initial attribute (see below).
Initial
Sets the initial value to be stored and used when the Initial Enable attribute is checked.
Unit Style
Sets the unit style to be used when displaying values. The unit style
values are: Int: displays integer values
Float: displays floating point values
Time: displays time values in milliseconds (ms)
Hertz: displays frequency values (Hz/kHz).
deciBel: displays loudness (dB)
%: Percentage
Pan: displays Left and Right values
Semitones: displays steps (st)
MIDI: displays pitch corresponding to the MIDI note number
Custom: displays custom data type
Native: defaults to floating point values
Custom Units
Sets the units to be used with the 'Custom' unit style (see "Unit Style", above). Custom unit strings may be simple symbols (e.g. "Harmonic(s)"), in which case the parameter's value will be displayed in its 'Native' display mode, followed by the symbol (e.g. "12 Harmonic(s)" for an Int-typed parameter or "12.54 Harmonic(s)" for a Float-typed parameter). For additional control over the numerical component displayed, a sprintf-style string may be used (e.g. "%0.2f Bogon(s)", which would display a value such as ".87 Bogons").
Exponent
When set to a value other than 1., the parameter's input and output values will be exponentially scaled according to the factor entered in this column.
Steps
The number of steps available between the minimum and maximum values of a parameter. For instance, if the parameter has a range from 0.-64., with Steps set to 4, the user can only set the parameter to 0, 21.33, 42.66 and 64.
Parameter Visibility
For automatable parameters (Int, Float, Enum), 'Stored Only' disables automation, although parameter values are stored in presets. 'Hidden' causes the parameter's value to be ignored when storing and recalling data. Non-automatable parameters (Blob) are 'Stored Only' by default, and can be set to 'Hidden', if desired.
Update Limit (ms)
Speed limits values triggered by automation.
Defer Automation Output
Defers values triggered by automation.
Messages
int
Arguments
float
Arguments
anything
Arguments
active
Arguments
alias
Arguments
alias [symbol]
For example, would alias the object at the location a_patcher::a_pattr to the name the_pattr.
Aliases can be used interchangeably with path names within the pattrstorage object, and are useful for referring to long paths by simpler, shorter names.
get The word get , followed by a symbol that specifies the path name of a client object, returns that object's alias (if any) from the pattrstorage object's outlet, preceded by the symbol .
clear
client_close
clientwindow
Arguments
copy
Arguments
from-index [int]
t0-index [int]
(mouse)
delete
Arguments
dump
fade
Arguments
fillempty
getactive
Arguments
getalias
Arguments
getclientlist
getcurrent
getedited
getinterp
Arguments
getlockedslots
getpriority
Arguments
getslotlist
getslotname
Arguments
getslotnamelist
Arguments
Without an argument, or with an argument of 0, the message will cause all slots from 0 to the largest stored slot number to be output, regardless of whether the slot has been defined or not. The facilitates the use of the message with objects such as umenu. To filter undefined slots (even if they have names), send the message with a non-0 argument.
For more information, see the pattrstorage object's help file.
getstoredvalue
Arguments
getsubscriptionlist
grab
insert
Arguments
interp
Arguments
- No interpolation. Same as no additional argument.
- Linear interpolation. Presets recalled using or messages will be interpolated using a standard linear algorithm.
- Threshold. Takes optional 3rd argument, which sets the threshold. Presets recalled using or messages will recall data from the first preset specified when the fade amount is below the threshold, and will recall data from the second preset specified when the fade amount is greater than or equal to the threshold.
- Inverse threshold. Takes optional 3rd argument ( ), which sets the threshold. Presets recalled using or messages will recall data from the first preset specified when the fade amount is greater than or equal to the threshold, and will recall data from the second preset specified when the fade amount is less than the threshold.
- Power curve. Takes optional 3rd argument ( ), which sets the exponent to which the fade amount will be raised. Presets recalled using or messages will recall data between the two specified presets, along the curve described. Power curves can be used to create faster or slower "attacks" and "decays" for the fade envelope.
- Table-specified curve. Takes optional 3rd argument ( ), which specifies the name of a table to use for curve lookup. Presets recalled using or messages will recall data between the two specified presets, along the curve described in the table. Tables are assumed to contain values between 0 and 100, representing the new fade amount * 100 (this is clipped internal to the pattrstorage object, but is not normalized). The length of the table is stretched to match the expected fade values (between 0 and 1), so any number of table entries can be used. If the lookup fade amount does not fall exactly onto a table-specified value, linear interpolation is used to determine the new fade amount. Please see the pattrstorage help file for examples of table-specified interpolation.
locate
Arguments
lock
Arguments
status [int]
lockall
Arguments
priority
Arguments
purge
read
Arguments
readagain
Arguments
recall
Arguments
Followed by 3 or 4 arguments, the message recalls interpolated data from 2 presets at a specified weight between the two. If the word is followed by two numbers that specify the indices of two presets and a a floating point number between 0 and 1.0 that specifies an interpolation value, the data for every object whose value is stored in the specified presets will be recalled.
If is followed by a symbol that specifies the path name or alias of a client object followed by two numbers that specify the indices of two presets and a floating point interpolation value, only the data for the specified object will be recalled.
In these latter cases, the floating point argument specifies the weight of the interpolation, and should be between 0. and 1. A floating point argument of would simply recall the data for the preset matching the first index, and would recall the data for the preset matching the second index. See the message for more information about interpolation modes.
recallmulti
Arguments
remove
Arguments
renumber
resolvealias
Arguments
setall
Arguments
setstoredvalue
Arguments
slotname
Arguments
slotname [symbol]
storage_close
storagewindow
Arguments
store
Arguments
A storage slot of '0' is allowed, but *IS NOT SAVED* in a file. It can be used as a temporary slot for interpolation activities or other non-permanent experiments.
storeagain
Arguments
storenext
Arguments
subscribe
Arguments
unsubscribe
Arguments
write
Arguments
writeagain
Arguments
writejson
Arguments
writexml
Arguments
Output
anything
Multiple messages, corresponding to the various input messages above.
See Also
Name | Description |
---|---|
autopattr | Expose multiple objects to the pattr system |
pattrforward | Send any message to a named object |
pattrhub | Access all pattr objects in a patcher |
pattrmarker | Provide pattr communication between patchers |
Max pattr Tutorial 2: Automatic Bindings and Storage | Max pattr Tutorial 2: Automatic Bindings and Storage |