Save and recall presets of pattr data
Name | Type | Opt | Description |
---|---|---|---|
name | symbol | opt | 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. |
int | preset-index [int] |
Recalls the data from the preset specified by | .
float | preset-index [float] |
Recalls the data from the preset specified by pattrstorage object will interpolate between the data stored in the preset corresponding to the integer portion of the float and the data stored at the preset numbered one higher (e.g. will cause pattrstorage to interpolate 50% between presets 1 and 2). See the message for more information about interpolation modes. | . If the number falls between two whole numbers (e.g. ), the
anything | arguments [list] |
Incoming messages to the pattrstorage object are analyzed. If the first element of the message matches the path name or alias of an object maintained by the pattrstorage object (visible in the object's client list), the subsequent arguments in the message set that object's value. Otherwise, the message is ignored. |
active | client-name [list] |
The word | , followed by a symbol that specifies the path name or alias of a client object and a 1 or 0, sets that object's active status. When a client object is active (default), its data will be recalled when presets are recalled--otherwise, the object is ignored during recall. Setting the state of a parent object (such as a patcher-any client object containing other client objects), automatically sets the state of the child objects of the parent to the same value.
alias | client-name and alias [list] |
The word For example, would alias the object at the location a_patcher::a_pattr to the name the_pattr. Aliases can be used interchangably 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 . |
, followed by two symbols, generates an alias for the client object whose path name is given in the first argument. The alias permits the object to be referred to by a name given in the second argument.
delete | preset-index [list] |
The word pattrstorage object's internal list. If is not followed by an argument, all presets are cleared and removed. See the message for further information on viewing the object's list of presets. | , followed by a number, clears any data in the preset whose index is specified by that number and removes the preset from the
dump | The word pattrstorage object's outlet as a series of messages, each in the form . The output of is finished when the message is output. | reports the current value of all client objects from the|
clear | The word pattrstorage object's internal list. | removes all presets from the|
client_close | Closes the client list window. | |
clientwindow | name [list] |
Opens the pattrstorage object's client list window (the title bar reads clientwindow (name), where (name) is the patcher name of the pattrstorage object which created the window). |
copy | preset-index and client-name [list] |
The word pattrstorage object referred to by the symbol will be copied to a preset slot, as specified by the second number, of the object receiving the message. For example, the message would cause preset 3 of the pattrstorage object called psto_parent, located in the parent patch of the pattrstorage object receiving the message, to be copied to preset 1 of the pattrstorage object receiving the message. In order for this to function reliably, client path names must match exactly. If they do not, the data for that client is ignored. | , followed by 2 or 3 arguments, copies the stored values from one numbered preset to another. Followed by 2 numbers, the stored values from the preset slot specified by the first number will be copied to the preset slot specified by the second number. If that slot doesn't yet exist, it will be automatically created. Followed by a symbol and 2 numbers, the stored values from a preset slot, as specified by the first number, of the
(mouse) | Double-clicking on a pattrstorage object opens the object's client list window, as if the object had received the message. | |
fade | list [list] |
Identical to the | message. Deprecated.
getactive | client-name [list] |
The word pattrstorage object's outlet, preceded by the symbol . | , followed by a symbol that specifies the path name or alias of a client object, reports the active status of the client object from the
getalias | client-name [list] |
The word pattrstorage to return that client-object's alias from its outlet. | , followed by a symbol that specifies the path name or alias of a client object, will cause
getclientlist | The word pattrstorage object's outlet as a series of messages, each preceded by the symbol . The output of is finished when the message is output. | reports the path names of any client objects from the|
getcurrent | The word pattrstorage object's outlet, preceded by the symbol . | reports the currently active preset from the|
getedited | The word pattrstorage object's outlet, preceded by the symbol . If the data in the currently active preset has been edited, the state is reported as . Otherwise, the edit state is reported as . | reports the edit state of the currently active preset from the|
getinterp | client-name [list] |
The word pattrstorage object's outlet, preceded by the symbol . | , followed by a symbol that specifies the path name or alias of a client object, reports that object's interpolation mode from the
getlockedslots | The word pattrstorage object's outlet as a list, preceded by the symbol . | reports the indices of any locked slots from the|
getpriority | client-name [list] |
The word pattrstorage object's outlet, preceded by the symbol . | , followed by a symbol that specifies the path name or alias of a client object, reports that object's priority from the
getslotlist | The word pattrstorage object's outlet, preceded by the symbol . | reports the numbers of any valid presets from the|
getslotname | preset-index [int] |
The word | , followed by a number, causes the name of the preset slot specified by the number to be output from the pattrstorage object's outlet, preceded by the symbol .
getslotnamelist | range [int] |
The word pattrstorage object's outlet as a series of messages, each preceded by the symbol . The output of is finished when the message is output. 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. |
, followed by an optional number, reports the slot names of all used slots to be sent from the
getstoredvalue | client-name [list] |
The word pattrstorage object's outlet, in the form . | , followed by a symbol that specifies the path name or alias of a client object and a number which specifies a preset, reports that object's value, as stored in that preset slot, from the
getsubscriptionlist | The word pattrstorage object's outlet as a series of messages, each preceded by the symbol . The output of is finished when the message is output. See the subscribemode attribute for more information. | causes the names of all subscribed objects to be sent from the|
grab | The word pattrstorage object. This is particularly useful when the pattrstorage object is managing client objects whose data changes internally, without sending notifications to the pattr system. | causes the current value of all client objects to be reacquired by the|
insert | preset-index [int] |
The word pattrstorage in a numbered preset. The number argument specifies the index of the preset to be stored. Any presets numbers at the specified index or higher are automatically incremented to make room for the inserted preset. | , followed by a number, stores the data for every object maintained by
interp | arguments [list] |
The word - No interpolation. Same as no additional argument. - Linear interpolation. Presets recalled using or messages will be interpolated using a standard linear algorithm. - Threshhold. 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 threshhold. - Inverse threshhold. 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 threshhold. - 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. |
, followed by at least 1 and up to 3 arguments ( , , ), sets the interpolation status and mode for a specific client object. The first symbol specifies the path name or alias of a client object. The second symbol argument determines the mode, and can be one of the following values:
locate | object_name [symbol] |
The word | , followed by a symbol corresponding to the path name or alias of an object, will cause the containing patcher of that object to be opened.
lock | preset-index and lock-status [list] |
The word | , followed by 2 numbers, sets the lock status for a particular preset number. The first argument specifies the preset number to be locked or unlocked. The second argument specifies the lock state, and should be either 0 (unlocked) or 1 (locked). Locked presets cannot be deleted (using the or messages) or overwritten (using the message). Locked presets can be moved (as a result of , or messages, if performed on other presets). Locks are saved in the preset data file.
lockall | status-flag (0 or 1) [list] |
The word | , followed by a number, sets the lock status for all presets at once. The argument specifies the lock state, and should be either 0 (unlocked) or 1 (locked). Locked presets cannot be deleted (using the or messages) or overwritten (using the message). Locked presets can be moved (as a result of , or messages, if performed on other, unlocked presets). Locks are saved in the preset data file.
priority | client-name [list] |
The word | , followed by a symbol that specifies the path name or alias of a client object and a number, sets the recall and display priority for that object. When presets are recalled, the data for client objects will be restored in the order established by . Lower priorities are executed first. Negative priorities are permitted. Priority is only respected within a single level of the patcher hierarchy. Data in parent patchers will always be restored before data in nested patchers.
purge | The word pattrstorage object, removing entries for client objects which have been deleted or moved. Typically, the pattrstorage object retains a reference to such objects, so that their settings ( , , , etc.) can be restored if the objects reappear. | rebuilds the internal client list of the|
setall | client-name [list] |
The word | , followed by a symbol that specifies the path name or alias of a client object and a variable number of additional arguments corresponding to the value of the client object, sets the value of the specified client object for all preset slots to that value. No data is sent to the client object itself.
setstoredvalue | client-name [list] |
The word | , followed by a symbol that specifies the path name or alias of a client object, a number which specifies a preset and a variable number of additional arguments corresponding to the data expected by the client object, sets the value of the specified client object within the specified preset slot to the specified data.
slotname | index and name [list] |
The word | , followed by a number and an optional symbol, sets the name of the preset slot specified by the number. If the symbol argument is not present, the name of the slot is removed. Undefined slots can be given names for labelling purposes.
store | client-name and preset-index [list] |
The word pattrstorage will be stored. If is followed by 2 arguments--a symbol and a number--and the symbol argument matches the path name or alias of a client object, only the data for the specified object will be stored. The number argument always specifies the index of the preset to be stored. If the preset index specified by the number argument is already in use, the existing data will be overwritten without a warning. | , followed by 1 or 2 arguments, stores data in a numbered preset. If the word is followed by a number, the data for every object maintained by
storeagain | client-name [list] |
The word | simply executes a operation, using the most recently-use preset slot. If there is no previously-used preset slot (if the message has never been sent to the object), the message is ignored.
storenext | client-name [list] |
The word pattrstorage object receives the message, the current state of the client objects would be stored to preset slot 3. A second message would cause the data to be stored to preset slot 5. | executes a operation, using the next empty preset slot, counting up from preset 1. For instance, if preset slots 1, 2 and 4 have data stored in them, and the
read | filename [list] |
The word pattrstorage object. If the argument is given, and represents a valid file path, the file will be read from that location--otherwise, a standard File Dialog will be presented for the user to manually choose the file to be read. | , followed by an optional symbol that specifies a filename, reads an XML file representing preset data from disk into the
readagain | filename [list] |
The word | re-reads an XML file previously specified by the or messages. If no file has been previously specified, a standard File Dialog will be presented for the user to manually choose the file to be read.
recall | client-name preset-indices and interpolation-value [list] |
The word 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 (see above), 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. |
, followed by 1 to 4 arguments, recalls data from a preset. If is followed by a number or a floating-point number, the data for every object whose value is stored in the specified preset (or in the interpolated preset represented by a floating-point number--see message, above) will be recalled. If is followed by 2 arguments--a symbol and a number--and the argument matches the path name or alias of a client object, only the data for the specified object will be recalled. The number argument always specifies the index (or interpolated index) of the preset to recall.
recallmulti | normalized-weight-pair [list] |
The word | , followed by at least 2 numeric arguments, permits weighted recall of multiple presets. Each argument determines the (normalized) weight of a particular preset in the final output. If the argument is an integer, the weight is 100%. If the argument is a floating point number, the integer part of the number determines the preset number, and the floating point part of the number determines the weight. For instance, would weight preset 1 at 30%, preset 2 at 30% and preset 5 at 40%. Since weights are normalized, the total weight can be higher than 100%; for instance, would calculate correct weights (27.77%, 27.77% and 44.44% respectively), and , and all result in the same output (33.33% for each member).
remove | preset-index [int] |
The word pattrstorage in a numbered preset. The number argument specifies the index of the preset to be removed. Any presets numbers higher than the specified index are automatically decremented. | , followed by a number, deletes the data for every object maintained by
renumber | The word | renumbers stored presets into consecutive preset slots, beginning with slot 1.|
resolvealias | client-name [list] |
The word pattrstorage object's outlet, preceded by the symbol . | , followed by a symbol that specifies the alias of a client object, returns that object's full path name (if any) from the
subscribe | subscribe-target [list] |
The word pattrstorage object's subscription list. See the subscribemode attribute for more information. | , followed by one or more symbols, each corresponding to the path name or alias of an object, will add the specified object to the
storage_close | Closes the stored data window. | |
storagewindow | name [list] |
Opens the pattrstorage object's stored data window (the title bar reads storagewindow (name), where (name) is the patcher name of the pattrstorage object which created the window). |
unsubscribe | subscribe-target [list] |
The word pattrstorage object's subscription list. See the subscribemode attribute for more information. | , followed by one or more symbols, each corresponding to the path name or alias of an object, will remove the specified object from the
write | filename [list] |
The word | , followed by an optional symbol that specifies a filename, writes any preset data to a file on disk. If the argument is given, and represents a valid file path, the file will be saved at that location--otherwise, a standard File Dialog will be presented for the user to manually choose a name and location for the file to be saved.
writeagain | filename [list] |
The word | writes any preset data to a file on disk previously specified by the or messages. If no file has been previously specified, a standard File Dialog will be presented for the user to manually choose a name and location for the file to be saved.
writejson | filename [list] |
The word | , followed by an optional symbol that specifies a filename, writes any preset data to a file on disk, in JSON format. If the argument is given, and represents a valid file path, the file will be saved at that location--otherwise, a standard File Dialog will be presented for the user to manually choose a name and location for the file to be saved.
writexml | filename [list] |
The word | , followed by an optional symbol that specifies a filename, writes any preset data to a file on disk, in XML format. If the argument is given, and represents a valid file path, the file will be saved at that location--otherwise, a standard File Dialog will be presented for the user to manually choose a name and location for the file to be saved.
Name | Type | g/s | Description |
---|---|---|---|
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 | float def.: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, tunnelling 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 the value of one of its client objects changes, in the form . The following modes are available: 0 = disabled 1 = output all changes to client objects 2 = output all non-repeated changes to client objects (see ) 3 = output all changes to client objects not initiated by a message to the pattrstorage object 4 = output all non-repeated changes to client objects not initiated by a message to the pattrstorage object (see ) |
|
parameter_enable | int | Enables parameter support. Please read the document Device Parameters in Max for Live for more information. | |
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 | float def.: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. |
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 |
Save and recall presets of pattr data | |
Max pattr Tutorial 2: Automatic Bindings and Storage | Max pattr Tutorial 2: Automatic Bindings and Storage |