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:
2026-08-09 14:36:49 -07:00
parent 392ae1525a
commit 132515b4cd
5 changed files with 102 additions and 57 deletions
@@ -194,13 +194,15 @@ public enum FactoryRigLibrary {
}
try board.append(DelayPedal()) { p in
p.time = 0.4
p.feedback = 2.2
p.feedback = 1.5
}
try board.append(ShimmerReverbPedal()) { p in
// Keep decay + shimmer feedback well below self-oscillation — high decay with the
// octave-up regeneration screeches into runaway feedback within seconds.
p.size = 0.09
p.decay = 0.85
p.shimmer = 0.55
p.damp = 0.35
p.decay = 0.55
p.shimmer = 0.3
p.damp = 0.5
}
}
@@ -646,64 +648,61 @@ public enum FactoryRigLibrary {
// MARK: Two-board split
/// A two-board split — a full effects chain vs a clean direct path — selectable like an on-board
/// effects loop. Showcases the multi-board router.
/// Two boards — a full effects chain and a clean direct path — switched with the board selector.
static let garciaOBELSplit: FactoryRig = FactoryRig(
id: stableID("Garcia OBEL Split"),
name: "Garcia OBEL Clean/Effects Split",
blurb: "Two boards, one footswitch: an effects/lead chain (octave, envelope filter, "
+ "overdrive, phaser, delay) versus a clean direct path — switch between them like an "
+ "on-board effects loop. In the spirit of a certain improvising guitarist's late-'80s "
+ "rig. Flip the router to A for effects, B for clean.",
blurb: "Two boards, one selector: Board 1 is an effects/lead chain (octave, envelope filter, "
+ "overdrive, phaser, delay); Board 2 is a clean direct path. Use the board Solo / Blend "
+ "control at the top to switch between them, like an on-board effects loop. In the "
+ "spirit of a certain improvising guitarist's late-'80s rig.",
category: .classic,
sessionBuild: { session in
let router: ChainRouter = try session.makeChainRouter()
// Board A — the effects / lead chain (effects loop engaged).
try router.appendToA(BassOctaverPedal()) { p in
// Board 1 — the effects / lead chain (effects loop engaged).
let effects: PedalBoard = try session.addBoard()
try effects.append(BassOctaverPedal()) { p in
p.oct1 = 0.5
p.direct = 1.0
p.mode = 1.0
}
try router.appendToA(MutantPedal()) { p in
try effects.append(MutantPedal()) { p in
p.sensitivity = 2.5
p.resonance = 5.0
}
try router.appendToA(OverdrivePedal()) { p in
try effects.append(OverdrivePedal()) { p in
p.drive = 5.0
p.tone = 4200.0
}
try router.appendToA(PhaserPedal()) { p in
try effects.append(PhaserPedal()) { p in
p.rate = 0.4
p.feedback = 0.4
}
try router.appendToA(DelayPedal()) { p in
try effects.append(DelayPedal()) { p in
p.time = 0.35
p.feedback = 1.8
}
try router.appendToA(CaliforniaAmpPedal()) { p in
try effects.append(CaliforniaAmpPedal()) { p in
p.gain = 5.0
p.bass = 0.55
p.mid = 0.6
p.treble = 0.6
}
try session.finalizeBoard(effects)
// Board B — the clean / direct path (effects loop bypassed).
try router.appendToB(CompressorPedal()) { p in
// Board 2 — the clean / direct path (effects loop bypassed).
let clean: PedalBoard = try session.addBoard()
try clean.append(CompressorPedal()) { p in
p.inputGain = 2.0
p.threshold = -16.0
p.ratio = 3.0
}
try router.appendToB(CaliforniaAmpPedal()) { p in
try clean.append(CaliforniaAmpPedal()) { p in
p.gain = 3.5
p.bass = 0.5
p.mid = 0.55
p.treble = 0.6
}
// Default to the effects board; the router's A/B control switches paths.
router.mode = .a
try router.finalize()
try session.finalizeBoard(clean)
}
)
@@ -107,9 +107,18 @@ extension ShoeGaze {
/// rebuilds every board with the all-or-nothing semantics of ``rebuildAllBoards(from:)``.
///
/// - Important: Call with the engine **stopped**, as with ``loadRig(from:)``.
/// - Parameter state: The rig snapshot to restore.
/// - Parameters:
/// - state: The rig snapshot to restore.
/// - keepingCurrentInput: When `true`, the session's current ``inputSource`` is preserved and
/// the rig's saved input is ignored — used when the player switches between rigs, so the live
/// input (e.g. a plugged-in guitar) doesn't snap back to the test loop a rig was authored
/// with. When `false` (the default, used by file open and launch restore), the rig's saved
/// input is applied so a saved/loaded rig recreates its authored input. Defaults to `false`.
/// - Throws: `PresetError.unsupportedVersion` for a too-new snapshot, or any board-build error.
public func loadRig(from state: ShoeGazeState) throws {
public func loadRig(
from state: ShoeGazeState,
keepingCurrentInput: Bool = false
) throws {
guard state.version <= presetFormatVersion else {
throw PresetError.unsupportedVersion(state.version)
}
@@ -120,11 +129,12 @@ extension ShoeGaze {
// enable-live-input flow (rebuild engine to 1 input, then load a rig saved with 0). Apply a
// rig's saved layout deliberately via `applyChannelLayout(from:)` / the config UI instead.
// Restore the saved input source before rebuilding, since board construction reads it. A
// saved live-input channel that no longer exists on this engine falls back to the test loop
// (same guard as reconfigureEngine), so the rebuild's addBoard() can't throw on a stale
// channel. Absent (older rig) → leave the current input source untouched.
if let savedInput: InputSource = state.inputSource {
// Restore the saved input source before rebuilding, since board construction reads it — unless
// the caller is switching rigs (`keepingCurrentInput`), in which case the current input is
// kept so the player's live input survives the switch. A saved live-input channel that no
// longer exists on this engine falls back to the test loop (same guard as reconfigureEngine),
// so the rebuild's addBoard() can't throw on a stale channel. Absent (older rig) → untouched.
if !keepingCurrentInput, let savedInput: InputSource = state.inputSource {
if case .liveInput(let channel) = savedInput,
channel < 0 || channel >= engine.numInputChannels {
inputSource = .testLoop
@@ -26,6 +26,7 @@ struct RigLibrarySidebarView: View {
private static let subtitleOpacity: Double = 0.5
private static let headerOpacity: Double = 0.65
private static let emptyOpacity: Double = 0.4
private static let tabPickerWidth: CGFloat = 168
// MARK: - Inputs
@@ -139,7 +140,7 @@ struct RigLibrarySidebarView: View {
}
}
/// Segmented Mine / Starters switch at the top of the list.
/// Segmented Mine / Starters switch, centered at the top of the list.
private var tabPicker: some View {
Picker("", selection: $tab) {
ForEach(RigTab.allCases) { option in
@@ -148,6 +149,9 @@ struct RigLibrarySidebarView: View {
}
.pickerStyle(.segmented)
.labelsHidden()
// Constrain the control's own width, then center it in the full column width.
.frame(maxWidth: RigLibrarySidebarView.tabPickerWidth)
.frame(maxWidth: .infinity, alignment: .center)
}
/// The user's own rigs — a flat, reorderable list.
@@ -1640,7 +1640,9 @@ public struct ShoeGazeBuilderView: View {
let wasRunning: Bool = shoeGaze.engine.isRunning
if wasRunning { shoeGaze.engine.stop() }
do {
try shoeGaze.loadRig(from: entry.state)
// Keep the player's currently-chosen input across the switch (e.g. a live guitar), rather
// than snapping to the input the selected rig was authored with.
try shoeGaze.loadRig(from: entry.state, keepingCurrentInput: true)
currentRigID = entry.id
selectedBoardIndex = 0
autosave()