Register stereo pedals for preset round-trip

Add Octave Splitter and Ping-Pong to PedalRegistry so rigs containing
them reconstruct on loadRig — board.add replays the mono→stereo width
transition automatically. Document that split-section topology (parallel
and stereo) remains outside the captured linear chain, as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 16:50:26 -07:00
parent f89229282f
commit 02cee9a358
2 changed files with 56 additions and 3 deletions
@@ -43,6 +43,50 @@ struct PresetTests {
return (sg, engine, url)
}
// MARK: - Stereo pedal round-trip
@Test func wideningPedalRigRoundTripsThroughFile() throws {
// A linear rig containing a widener + a downstream mono pedal must round-trip:
// the registered widener replays the mono → stereo transition on load, and the
// downstream pedal auto-stereoizes.
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.1, numAudioBuses: 128)
defer { try? FileManager.default.removeItem(at: url) }
let presetURL: URL = FileManager.default.temporaryDirectory
.appendingPathComponent(UUID().uuidString + ".json")
defer { try? FileManager.default.removeItem(at: presetURL) }
let sg: ShoeGaze = ShoeGaze(engine: engine)
let board: PedalBoard = try sg.addBoard()
let octave: OctaveUpSplitterPedal = OctaveUpSplitterPedal()
octave.drive = 22.0
try board.add(octave)
try board.add(DelayPedal())
try sg.finalizeBoard(board)
#expect(board.width == 2, "Rig should be stereo before saving")
try sg.saveRig(to: presetURL)
try sg.loadRig(from: presetURL)
// After reload: same topology + restored parameter.
guard let loadedBoard: PedalBoard = sg.boards.first else {
Issue.record("No board after loadRig")
return
}
#expect(loadedBoard.width == 2, "Widener should re-widen the board on load")
#expect(loadedBoard.pedals.count == 2, "Both pedals should be reconstructed")
guard let loadedOctave: OctaveUpSplitterPedal =
loadedBoard.pedals.first as? OctaveUpSplitterPedal else {
Issue.record("Octave Splitter not reconstructed (registry miss?)")
return
}
#expect(loadedOctave.$drive.value == 22.0, "Widener drive should be restored")
}
@Test func pingPongPedalIsRegistered() throws {
let pedal: Pedal? = PedalRegistry.makePedal(type: "Ping-Pong")
#expect(pedal is PingPongDelayPedal, "Ping-Pong should be registered")
}
// MARK: - In-memory round-trip
@Test func captureStateRoundTripEquality() throws {