The state saver (private/src/StateSaver.hpp) handles persistence of non-encoder runtime control state to/from JSON. It is not the general persistence layer for the whole synth.
StateSaver is a fixed-width per-scene registry for non-encoder state only. Encoder state never touches StateSaver: encoders serialize separately via EncoderBankBank::ToJSON() / FromJSON() (private/src/EncoderBankBank.hpp), which iterate the encoder array and write each named parameter.
In TheNonagonSquiggleBoyInternal, the two persistence paths sit side by side in the patch JSON:
"squiggleBoy" key (via SquiggleBoy::ToJSON(), which serializes the EncoderBankBank)StateSaver state is written under the separate "stateSaver" keyStateSaver bridges live in-memory non-encoder values and serialized patch/project state:
ToJSON)SetFromJSON)It is saved and loaded alongside Nonagon and SquiggleBoy state.
SquiggleBoyConfigGrid also persists sample-source directory choices. It writes a sampleDirectoryRelative array with one relative path per voice; on restore, each non-empty path is resolved under the configured sample root and loaded asynchronously through IoTaskThread::PushLoadAudioBufferBankFromDirectory(...).
StateSaverTemp<NumScenes> stores compact per-scene snapshots for registered values:
1/2/4/8)This design keeps serialization generic while preserving exact typed values.
StateSaver works with scene logic so scene-specific values are retained: