Struct nih_plug::wrapper::state::PluginState
source · pub struct PluginState {
pub version: String,
pub params: BTreeMap<String, ParamValue>,
pub fields: BTreeMap<String, String>,
}
Expand description
A plugin’s state so it can be restored at a later point. This object can be serialized and deserialized using serde.
The fields are stored as BTreeMap
s so the order in the serialized file is consistent.
Fields§
§version: String
The plugin version this state was saved with. Right now this is not used, but later versions of NIH-plug may allow you to modify the plugin state object directly before it is loaded to allow migrating plugin states between breaking parameter changes.
Notes
If the saved state is very old, then this field may be empty.
params: BTreeMap<String, ParamValue>
The plugin’s parameter values. These are stored unnormalized. This means the old values will be recalled when when the parameter’s range gets increased. Doing so may still mess with parameter automation though, depending on how the host implements that.
fields: BTreeMap<String, String>
Arbitrary fields that should be persisted together with the plugin’s parameters. Any field
on the Params
struct that’s annotated with #[persist = "stable_name"]
will be persisted this way.
The individual fields are also serialized as JSON so they can safely be restored independently of the other fields.
Trait Implementations§
source§impl Clone for PluginState
impl Clone for PluginState
source§fn clone(&self) -> PluginState
fn clone(&self) -> PluginState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more