Fundamentals
Export Targets
Code Export
Patcher UI
Special Topics
RNBO Raspberry Pi OSCQuery Runner
Presets With Snapshots
Values stored in param and event UI objects, toggle, number, slider, and dial objects can currently be included in snapshots.
The rnbo~ object supports preset state saving using Max snapshots.
Supported Objects
Values stored in param and event UI objects (toggle, number, slider, and dial) can currently be included in snapshots. The signal version of param~ and signal UI objects (i.e., scope~, meter~ and number~ are not supported in the snapshot system.
Similarly, audio samples or buffer objects that contain data are not stored in snapshots.
Setting Up Your rnbo~ Object Patcher for Snapshots
To use snapshots you must first save your Max patch. This applies to both RNBO and standard Max snapshots. Snapshots will then be saved in the same directory as your patcher.
What Is Included?
All param objects (but not param~) are automatically included in snapshots, however, event UI objects in RNBO, toggle, number, slider, and dial are not exposed to RNBO presets by default. To expose them to the snapshot system, navigate to the inspector for that object and checking the box that says Add this value to preset.
Patching for Snapshots
When using param before UI objects, the internal param state is not updating when changes are made directly to the UI object, but they are correctly updated when you recall your snapshots. If you use the UI element before param, it is not updated on snapshot recall. Note that there are tradeoffs to each solution.
Managing Snapshots in the Sidebar
To take a snapshot of your rnbo~ object state, you must be in the Max patcher that contains your rnbo~ object.
Unlock the patcher and highlight the rnbo~ object, then click on the snapshot sidebar icon.
From here, click on the +
icon or the New...
button to add a new snapshot and the play button to recall it. Just like standard Max snapshots, you can embed them in the patcher and rename them as you see fit.
Managing Snapshots With Messages to rnbo~
In addition to the sidebar, RNBO supports snapshots using messages to the object's left inlet. The supported messages are:
snapshot [userpath (optional)] [index (optional)] [name (optional)]
restore [index (optional)]
addsnapshot [userpath (optional)] [index (optional)] [name (optional)]
deletesnapshot [index]
setsnapshotname [index] [name]
deletesnapshot [index]
setembedsnapshot [index] [embedstate]
movesnapshot [srcindex] [dstindex]
exportsnapshot [srcindex] [userpath]
importsnapshot [dstindex] [userpath]
Building to a Target With Snapshots
This functionality is under development and varies by target. For supported targets, the export sidebar will include an option Include Presets that will allow you to export your snapshots as presets.
How exactly presets are supported varies by target.
Not yet supported
- Max external: Not yet supported.
Supported
- JS code: The preset file will be exported to a
data
directory. The RNBO device supports a functionsetPreset
that can load presets from this file. - Static webpage: The preset file will be exported to a
data
directory. The static webpage will include a dropdown for choosing presets. - Raspberry Pi: Snapshots will be exported to a presets file. The RNBO runner will simply load the first preset when the runner starts or loads a new patcher. Using the rnbo.remote object, prioritization of which preset will load on the runner can be used using the preset message to load, save, delete, and set which preset loads when the runner starts or loads a new patcher.
- Audio Plugin: Snaphots will be exported with the audio plugin. The plugin preset can be loaded from the
Program
namespace . - C++ code: The preset file will be exported, and the RNBO namespace includes a
PresetList
convenience wrapper that makes it easier to load presets from the exported file. In a JUCE application, you might read in aPresetList
like so:
// Read the preset file, if available File presets = File::getSpecialLocation(File::currentApplicationFile).getChildFile("Contents/Resources/presets.json"); if (presets.existsAsFile()) { String s = presets.loadFileAsString(); _presetList = new PresetList(s.toStdString()); }
With the PresetList
object wrapping the contents of the file, it's easy to retrieve and set a preset. Again in the context of JUCE, you might set a preset like so:
void JuceAudioProcessor::setCurrentProgram (int index) { if (_presetList) { _currentPresetIdx = index; UniquePresetPtr preset = _presetList->presetAtIndex(index); _rnboObject.setPreset(std::move(preset)); } }