fix(rigs): address starter-rig feedback (toggle, Garcia, shimmer, input)
- Center the Mine/Starters toggle in the sidebar column. - Garcia rig: build it as two plain boards (effects + clean) selected via the multi-board Solo/Blend control, instead of a ChainRouter — the builder UI renders boards, not routers, so the router version showed empty boards. - Dreampop Chorus Cathedral: lower shimmer decay/feedback and delay feedback so the octave-up regeneration no longer screeches into runaway feedback. - Preserve the current input across rig switches: loadRig gains a keepingCurrentInput flag (default false → file open / launch restore still apply the rig's saved input; RigStore session-restore continuity intact), and the rig-switch path (loadEntry) passes true so a live guitar isn't snapped back to the test tone when changing rigs. Tests updated to cover both directions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -422,11 +422,13 @@ struct PresetTests {
|
||||
try sg.loadRig(from: presetURL)
|
||||
#expect(abs(sg.clock.bpm - savedBpm) < 1e-9, "bpm should restore to \(savedBpm)")
|
||||
#expect(sg.tempoEnabled == false, "tempoEnabled should restore to false")
|
||||
#expect(sg.inputSource == .testLoop, "input source should restore to test loop")
|
||||
// Input is a live session setting, not part of the recalled rig: the session was on the test
|
||||
// loop and stays there (load never changes the current input).
|
||||
#expect(sg.inputSource == .testLoop, "load leaves the current input source unchanged")
|
||||
}
|
||||
|
||||
@Test func liveInputSourcePersistsAndFallsBackWhenChannelMissing() throws {
|
||||
// Engine WITH an input channel: a live-input rig round-trips its source.
|
||||
@Test func loadPreservesCurrentInputSourceNotTheSavedOne() throws {
|
||||
// A rig captured with live input still RECORDS its source in the snapshot...
|
||||
let (engineIn, urlIn): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numInputChannels: 1,
|
||||
@@ -434,29 +436,57 @@ struct PresetTests {
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlIn) }
|
||||
let sgIn: ShoeGaze = ShoeGaze(engine: engineIn, inputSource: .liveInput(channel: 0))
|
||||
let board: PedalBoard = try sgIn.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try sgIn.finalizeBoard(board)
|
||||
let liveBoard: PedalBoard = try sgIn.addBoard()
|
||||
try liveBoard.add(OverdrivePedal())
|
||||
try sgIn.finalizeBoard(liveBoard)
|
||||
let liveState: ShoeGazeState = sgIn.captureState()
|
||||
#expect(liveState.inputSource == .liveInput(channel: 0), "capture records the live input")
|
||||
|
||||
let state: ShoeGazeState = sgIn.captureState()
|
||||
#expect(state.inputSource == .liveInput(channel: 0), "capture should record the live input")
|
||||
|
||||
// Reload into the same input-capable engine: source preserved.
|
||||
try sgIn.loadRig(from: state)
|
||||
#expect(sgIn.inputSource == .liveInput(channel: 0), "live input should round-trip")
|
||||
|
||||
// loadRig does NOT auto-apply the saved channel layout, so loading into an engine with no
|
||||
// input channels falls back to the test loop rather than clobbering the engine's config.
|
||||
let (engineNoIn, urlNoIn): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
// ...but loading a rig NEVER switches the session's current input — switching rigs keeps
|
||||
// whatever input the player has chosen. Here a test-loop session loads a live-input rig on an
|
||||
// engine that DOES have the channel: under the old "restore saved input" behaviour this would
|
||||
// become live input; the new behaviour leaves it on the test loop.
|
||||
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numInputChannels: 0,
|
||||
numInputChannels: 1,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlNoIn) }
|
||||
let sgNoIn: ShoeGaze = ShoeGaze(engine: engineNoIn)
|
||||
try sgNoIn.loadRig(from: state)
|
||||
#expect(engineNoIn.numInputChannels == 0, "loadRig must not reconfigure the engine's I/O")
|
||||
#expect(sgNoIn.inputSource == .testLoop, "missing channel should fall back to test loop")
|
||||
defer { try? FileManager.default.removeItem(at: urlA) }
|
||||
let sgA: ShoeGaze = ShoeGaze(engine: engineA) // defaults to .testLoop
|
||||
try sgA.loadRig(from: liveState, keepingCurrentInput: true)
|
||||
#expect(sgA.inputSource == .testLoop, "switch must keep the current input, not adopt the rig's")
|
||||
|
||||
// The reverse: a live-input session loading a test-loop rig stays on live input.
|
||||
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1,
|
||||
numInputChannels: 1,
|
||||
numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlB) }
|
||||
let sgTestLoop: ShoeGaze = ShoeGaze(engine: engineB) // .testLoop
|
||||
let plainBoard: PedalBoard = try sgTestLoop.addBoard()
|
||||
try plainBoard.add(OverdrivePedal())
|
||||
try sgTestLoop.finalizeBoard(plainBoard)
|
||||
let testLoopState: ShoeGazeState = sgTestLoop.captureState()
|
||||
#expect(testLoopState.inputSource == .testLoop)
|
||||
|
||||
sgIn.currentRigID = nil
|
||||
try sgIn.loadRig(from: testLoopState, keepingCurrentInput: true)
|
||||
#expect(sgIn.inputSource == .liveInput(channel: 0),
|
||||
"switch must keep the current live input, not adopt the rig's test loop")
|
||||
|
||||
// A default load (file open / launch restore) still applies the rig's saved input.
|
||||
let (engineC, urlC): (SynthesisEngine, URL) = makeNRTEngine(
|
||||
duration: 0.1, numInputChannels: 1, numAudioBuses: 128
|
||||
)
|
||||
defer { try? FileManager.default.removeItem(at: urlC) }
|
||||
let sgDefault: ShoeGaze = ShoeGaze(engine: engineC) // .testLoop
|
||||
try sgDefault.loadRig(from: liveState) // default: restore saved input
|
||||
#expect(sgDefault.inputSource == .liveInput(channel: 0),
|
||||
"a default load restores the rig's saved input")
|
||||
|
||||
// loadRig still never reconfigures the engine's channel layout.
|
||||
#expect(engineA.numInputChannels == 1, "loadRig must not reconfigure the engine's I/O")
|
||||
}
|
||||
|
||||
@Test func channelCountsPersistButLoadDoesNotReconfigure() throws {
|
||||
|
||||
Reference in New Issue
Block a user