From 573a91f377b537d602d838293e4c410376d3c561 Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Mon, 3 Aug 2026 15:11:32 -0700 Subject: [PATCH] refactor(amps): hoist shared switch/leadBias constants to AmpVoicePedal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit switchOffValue (0.0) / switchOnValue (1.0) were re-declared in six amp files and leadBias (0.15) in two. Hoist all three onto AmpVoicePedal as internal `let`s so every subclass inherits them; remove the per-file duplicates. Pure refactor — no behavior change; 610 tests stay green. Co-Authored-By: Claude Opus 4.8 --- Sources/LyrebirdShoeGaze/Pedals/AmpVoicePedal.swift | 6 ++++++ Sources/LyrebirdShoeGaze/Pedals/BoutiqueAmpPedal.swift | 4 ---- Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift | 5 ----- Sources/LyrebirdShoeGaze/Pedals/ChimeTopBoostAmpPedal.swift | 2 -- .../LyrebirdShoeGaze/Pedals/FullertonDriveAmpPedal.swift | 2 -- .../LyrebirdShoeGaze/Pedals/FullertonReverbAmpPedal.swift | 2 -- Sources/LyrebirdShoeGaze/Pedals/JazzCleanAmpPedal.swift | 2 -- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Sources/LyrebirdShoeGaze/Pedals/AmpVoicePedal.swift b/Sources/LyrebirdShoeGaze/Pedals/AmpVoicePedal.swift index 1b597a6..b1d0011 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/AmpVoicePedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/AmpVoicePedal.swift @@ -160,6 +160,12 @@ open class AmpVoicePedal: Pedal { private let preampBias: Double = 0.2 /// Oversampling factor for the preamp stage (4× — the preamp can be driven hard by `Gain`). let preampOversample: Int = 4 + /// Grid bias of a cascaded lead/drive `TriodeStage` — a little asymmetry for even-harmonic + /// grind. Shared by the channel/master amps' cascaded ``preampStage(_:)`` overrides. + let leadBias: Double = 0.15 + /// Generic `PedalSwitch` off / on values, shared by every amp that publishes switches. + let switchOffValue: Double = 0.0 + let switchOnValue: Double = 1.0 /// Fixed power-amp stage drive/bias (gentler than the preamp). private let powerAmpDrive: Double = 1.5 private let powerAmpBias: Double = 0.0 diff --git a/Sources/LyrebirdShoeGaze/Pedals/BoutiqueAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/BoutiqueAmpPedal.swift index 3baccc9..82a9ddf 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/BoutiqueAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/BoutiqueAmpPedal.swift @@ -36,13 +36,9 @@ open class BoutiqueAmpPedal: AmpVoicePedal { private let depthSlope: Double = 0.7 private let masterMinDrive: Double = 0.5 private let masterMaxDrive: Double = 5.0 - /// Grid bias of the cascaded lead stage — a little asymmetry for even-harmonic grind. - private let leadBias: Double = 0.15 private let channelThreshold: Double = 0.5 private let driveRange: ClosedRange = 1.0 ... 30.0 - let switchOffValue: Double = 0.0 - let switchOnValue: Double = 1.0 public override var toneStackModel: ToneStackModel { .marshall } public override var signatureKnobs: [PedalKnob] { diff --git a/Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift index 29e4e34..55097ca 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift @@ -29,11 +29,6 @@ open class BritishComboAmpPedal: AmpVoicePedal { private let brightFreqHz: Double = 3500.0 private let brightMaxGainDb: Double = 6.0 private let brightSlope: Double = 0.7 - let switchOffValue: Double = 0.0 - let switchOnValue: Double = 1.0 - /// Grid bias of a cascaded lead/drive `TriodeStage` — a little asymmetry for even-harmonic - /// grind. Shared by the master-volume subclasses' cascaded ``preampStage(_:)``. - let leadBias: Double = 0.15 public override var toneStackModel: ToneStackModel { .marshall } public override var signatureKnobs: [PedalKnob] { diff --git a/Sources/LyrebirdShoeGaze/Pedals/ChimeTopBoostAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/ChimeTopBoostAmpPedal.swift index c41d73a..73ad9ec 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/ChimeTopBoostAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/ChimeTopBoostAmpPedal.swift @@ -50,8 +50,6 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal { private let cutRange: ClosedRange = 0.0 ... 1.0 private let speedRange: ClosedRange = 0.5 ... 12.0 private let intensityRange: ClosedRange = 0.0 ... 1.0 - private let switchOffValue: Double = 0.0 - private let switchOnValue: Double = 1.0 // MARK: - Voice configuration diff --git a/Sources/LyrebirdShoeGaze/Pedals/FullertonDriveAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/FullertonDriveAmpPedal.swift index 0e3bda4..83982b3 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/FullertonDriveAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/FullertonDriveAmpPedal.swift @@ -36,8 +36,6 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal { private let reverbRange: ClosedRange = 0.0 ... 1.0 private let driveRange: ClosedRange = 1.0 ... 30.0 - private let switchOffValue: Double = 0.0 - private let switchOnValue: Double = 1.0 public override var toneStackModel: ToneStackModel { .fender } public override var summaryText: String { diff --git a/Sources/LyrebirdShoeGaze/Pedals/FullertonReverbAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/FullertonReverbAmpPedal.swift index 6842163..88af17a 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/FullertonReverbAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/FullertonReverbAmpPedal.swift @@ -53,8 +53,6 @@ open class FullertonReverbAmpPedal: AmpVoicePedal { private let reverbRange: ClosedRange = 0.0 ... 1.0 private let speedRange: ClosedRange = 0.5 ... 12.0 private let intensityRange: ClosedRange = 0.0 ... 1.0 - private let switchOffValue: Double = 0.0 - private let switchOnValue: Double = 1.0 // MARK: - Voice configuration diff --git a/Sources/LyrebirdShoeGaze/Pedals/JazzCleanAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/JazzCleanAmpPedal.swift index 91e5597..a3fe467 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/JazzCleanAmpPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/JazzCleanAmpPedal.swift @@ -63,8 +63,6 @@ public final class JazzCleanAmpPedal: AmpVoicePedal { private let chorusRateRange: ClosedRange = 0.1 ... 5.0 private let chorusDepthRange: ClosedRange = 0.0005 ... 0.015 private let driveRange: ClosedRange = 1.0 ... 30.0 - private let switchOffValue: Double = 0.0 - private let switchOnValue: Double = 1.0 // MARK: - Voice configuration