Skip to main content

Module state

Module state 

Source
Expand description

The plug-in state of a preset, and the check of a state the plug-in saved back.

Vital’s state is the preset JSON as text with a trailing NUL, the form the plug-in saves itself. The builder forces the recipe’s oversampling into the controls, because oversampling changes the sound.

The builder also gives each state a tuning: the preset’s own, or Vital’s default. The plug-in keeps its current tuning when a state has none, so one host session would play the next preset in the last tuning.

A host call reports success even when the plug-in kept its old sound, so a backend reads the state back and compares it with the sent one: the name, the tuning and every control. The plug-in keeps controls as 32-bit floats, so a number matches within one f32 step. Structured parts such as the sample, the wavetables and the routes are not compared: Vital 1.0.7 re-encodes the sample and restamps the wavetables when it saves.

Structs§

Mismatch
A part of the sent state that the saved state does not hold.

Constants§

TEMPO_PATH
The path of the tempo control in a Mismatch.

Functions§

preset_state
Builds the plug-in state of preset, a preset file of synth.
readback_mismatches
Compares the preset JSON of a sent state with the one in a saved state: the name, the tuning and every control, a number under settings. Keys the plug-in adds on save are ignored.
saved_preset
Finds the preset JSON inside a state: the first JSON object that holds settings. A state the plug-in saved wraps the JSON in binary headers and a trailer; a state the builder made is the JSON itself.
vital_beats_per_second
The tempo Vital stores for a host tempo of bpm, in beats per second.