A [jsui] replacement for the [preset] object in Cycling'74 Max.
## Features
- Same click + modifier key behavior as the vanilla object to store and delete presets
- Drag and drop presets to re-organize
- Display presets as a grid or a list
- Scrollable list layout (requires Max 8.6.2)
- Scrollable (requires Max 8.6.2)
- Shows active preset even if recalled directly from pattrstorage
- Shows previously active preset, with the ability to ignore preset 0 if it being used as an intermediary step
- Shows presets being interpolated (using recall or recallmulti)
@ -15,27 +14,24 @@ A [jsui] replacement for the [preset] object in Cycling'74 Max.
- Ability to rewrite json file automatically every time a preset is stored/moved/deleted/renamed/(un)locked
- Helps keeping in sync a umenu with the list of stored slotstlet
- More look customization
- Dynamically adapts to resize both in Edit and Presentation mode
- Select mode: simple click selects the slot, double click recalls it (allows for organizing presets without recalling them)
- Color mode: ability to color sstored presets with 6 customizable colors (currently colors are only assigned automatically depending on slot number)
- Same click + modifier key behavior as the vanilla object to store or delete presets
## How to use
- Place `tc.preset.js` in the same directory as your patch, or somewhere in the Max search path
- Create a [`jsui @filename tc.preset.js`].
- Create a [`jsui @filename tc.preset.js`]. You can either add `@jsarguments` followed by the name of the pattrstorage you want to communicate with, or set that later by sending a `pattrstorage` (followed by the pattrstorage name) message to the [jsui].
- Connect the [pattrstorage] outlet to the [jsui] inlet
- Set the jsui attribute named "pattrstorage" to the name of the pattrstorage you just connected (or send a message like "pattrstorage my_pattrstorage_name")
## Limitations
- Resize doesn't work in Presentation mode (jsui limitation)
- Due to the way [pattrstorage] works, some pattrstorage-specific messages should be sent to the [jsui] instead of the [pattrstorage]. Some to both:
- `recall`: send to [pattrstorage] only
- `recall`, `delete`: send to [pattrstorage] only
- `recallmulti`, `slotname`: send to [pattrstorage] first (for better timing), then to the [jsui]
- `store`: send to [jsui] only
- Some messages to pattrstorage causes the jsui to be out of sync (`clear`, `insert`, `lockall`, `read`, `readagain`, `remove`, `renumber`). If you use any of these messages, make sure to then send a `resync` to the jsui.
- The js program send a lot of message to the [pattrstorage] (using `maxobj.message()`syntax, so without patch cord), which in return send (using a patch cord) a lot of messages required for the [jsui] to stay in sync. Using one of the above messages incorrectly, or sending `getslotlist`, `getslotnamelist`, or any message that will impact the presets might cause the [pattrstorage] to get out of sync. In case something like that happens, you can send the `resync` message to the [jsui].
## Desired features (for someday, if ever)
## Desired features (for someday)
- Select mode: simple click selects the slot, double click recalls it
- No need for a patch cord (programmatically create a [send]/[receive] pair?)
- Ability to lock/unlock and rename directly in the jsui without the need of external objects
- Ability to target a [pattrstorage] in a different patcher level
tc.preset is a jsui clone of the preset object, but loaded with more features, such as preset organization through drag and drop, display as a scrollable list, auto-rewrite the saved JSON/XML file after any change.
Contrary to the preset object, tc.preset has to be used in conjonction with a pattrstorage object.<modificationclass=""></modification>
<digest>Name of the pattrstorage to control</digest>
<description>Name of the pattrstorage this object should be linked to.</description>
</objarg>
</objarglist> -->
<!--MESSAGES-->
<methodlist>
<methodname="int">
<digest>Recall numbered preset</digest>
<description>Sending any integer will trigger the preset of the same number</description>
</method>
<methodname="float">
<digest>Interpolate between presets</digest>
<description>Recalls the data from the preset specified by float. If the number falls between two whole numbers (e.g. 1.5), the 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. 1.5 will cause pattrstorage to interpolate 50% between presets 1 and 2). See the interp message for more information about interpolation modes.</description>
</method>
<methodname="bang">
<digest>Recall last recalled preset</digest>
<description>When a bang is received, the last triggered preset is triggered again.</description>
</method>
<!-- <method name="list">
<digest>Function depends on inlet</digest>
<description>Function depends on inlet</description>
</method> -->
<methodname="pattrstorage">
<digest>Link to named pattrstorage object</digest>
<description>The word 'pattrstorage' followed by the name of an existing pattrstorage links the jsui to that pattrstorage.
Make sure that pattrstorage outlet is connected to the jsui left inlet prior to send the message.
If the word `pattrstorage`is sent alone, the jsui is unlinked from any pattrstorage.
</description>
</method>
<methodname="resync">
<digest>Resync the jsui to the pattrstorage</digest>
<description>The word 'resync' will repopulate the jsui with the current preset list from the pattrstorage. It is usefull in case you add/remove/edit presets without using the jsui.
</description>
</method>
<methodname="setlock">
<digest>Lock or unlock selected preset</digest>
<description>The word 'setlock' followed by a 0 or a 1 respectively unlocks or locks the currently selected preset in the jsui.
Note that if select_mode is set to 1, the selected preset is not necessarily the last recalled one.
</description>
</method>
<methodname="setslotname">
<digest>Set the name of the selected preset</digest>
<description>The word 'setslotname' followed by a symbol sets that symbol as the name of the currently selected preset in the jsui.
Note that if select_mode is set to 1, the selected preset is not necessarily the last recalled one.
</description>
</method>
<methodname="text">
<digest>Set the name of the selected preset</digest>
<description>Same as setslotname. Allows to connect the leftmost outlet of a textedit to the jsui and use it as an interface to rename the selected presets.
<description>When set to 1, the jsui will automatically send a "writeagain" message to its linked pattrstorage anytime a preset have been stored, moved, renamed, (un)locked or deleted, saving any change into the preset file immediately.</description>
"text" : "Pattrstorage messages that doesn't trigger output and need to be sent to the jsui instead:\n- store (send to jsui only)\n- recallmulti (send to pattrstorage first for timing accuracy, then to jsui)\n- slotname (send \"setslotname\" or \"text\" to jsui instead, will rename selected slot)\n- lock (or setlock to lock/unlock of the active slot)\n- some other. I've not tested them all. "
"text" : "Pattrstorage messages that doesn't trigger output and need to be sent to the jsui instead:\n- store (send to jsui only)\n- recallmulti (send to pattrstorage first for timing accuracy, then to jsui)\n- slotname (send \"setslotname\" or \"text\" to jsui instead, will rename active slot)\n- lock (or setlock to lock/unlock of the active slot)\n- some other. I've not tested them all. "