Serialize split-region topology in presets
Replace the flat per-board pedal list with an ordered [BoardSegmentState] (pedal | parallel | stereoSplit | mergeToMono) so parallel and stereo split regions — branch pedal chains plus SplitMode/StereoRoute — round-trip through saveRig/loadRig and rebuildBoard. - PedalBoard.orderedSegments tracks chain structure (add/split/splitStereo/ mergeToMono); captureState() walks it; rebuildSegments() replays it. - BoardState backward-compatible: decodes legacy flat `pedals` arrays; computed `pedals` exposes the linear subset; throws on a file missing both keys. BoardSegmentState wire discriminators documented. - applyState (lightweight recall) extended to branch pedals + routing modes. - Unknown pedal types skipped on load, including inside branches. - Tests: parallel / stereo / mergeToMono file round-trips, legacy decode, unknown-pedal-in-branch, branch-param recall. Suite 116/116; demo builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -183,15 +183,24 @@ exposed on `StereoSplitSection` so the route control can observe its `@Observabl
|
||||
|
||||
## Presets
|
||||
|
||||
A saved rig captures each board's *linear* `pedals` chain only (unchanged). Wideners and
|
||||
stereo-native pedals added via `board.add(_:)` are in that chain, so they round-trip — the
|
||||
mono → stereo width transition replays on load. `OctaveUpSplitterPedal` ("Octave Splitter") and
|
||||
`PingPongDelayPedal` ("Ping-Pong") are registered in `PedalRegistry`. Split-region *topology*
|
||||
(`splitStereo()` branches) is not serialized — the same limitation as parallel `split()`.
|
||||
A saved rig captures each board's full topology as an ordered `[BoardSegmentState]` —
|
||||
`PedalBoard.orderedSegments`, maintained by `add`/`split`/`splitStereo`/`mergeToMono`. A segment
|
||||
is a linear pedal, a parallel section (branch chains + `SplitMode`), a stereo split region
|
||||
(branch chains + `StereoRoute`), or a `mergeToMono` collapse. `captureState()` walks it;
|
||||
`loadRig`/`rebuildBoard` replay each segment via the matching `PedalBoard` API, so split regions
|
||||
and width transitions round-trip faithfully. `applyState` (lightweight recall) also walks
|
||||
segments, restoring branch-pedal params and routing modes positionally.
|
||||
|
||||
`BoardState` decodes legacy presets (flat `pedals` array, no `segments`) by wrapping each pedal
|
||||
as a `.pedal` segment; new files encode `segments` only. `BoardSegmentState` wire discriminators
|
||||
are the case names — renames are a format break. Wideners and stereo-native pedals
|
||||
(`OctaveUpSplitterPedal` "Octave Splitter", `PingPongDelayPedal` "Ping-Pong") are registered in
|
||||
`PedalRegistry`. Unknown pedal types are skipped on load, including inside branches.
|
||||
|
||||
The macOS Demo app has a `.stereo` mode (`ShoeGazeDemoController.buildStereo()` +
|
||||
`DemoRootView.stereoContent`): Overdrive → `splitStereo(Delay | Ping-Pong)` → `collectStereo`,
|
||||
with the four route modes selectable live.
|
||||
|
||||
Deferred (follow-up): serializing split-region topology (would also need to cover parallel
|
||||
sections for consistency); an iOS demo showcase (the iOS demo app has no mode switcher).
|
||||
Deferred (follow-up): an iOS demo showcase (the iOS demo app has no mode switcher); rendering
|
||||
the board's `orderedSegments` directly in a generic board view (today the UI composes pedal
|
||||
rows and section views separately).
|
||||
|
||||
Reference in New Issue
Block a user