feat(amps): Reverb + Vibrato footswitches on Fullerton Reverb

Model the amp's two-button footswitch: Reverb and Vibrato switches that bypass
each onboard effect to a dry pass-through while preserving the knob positions.
Both gate live by scaling the wet amount to zero — reverb mix → 0 (SpringReverb
passes dry), tremolo depth → 0 (LFO collapses to a constant 1.0) — so Off is a
true identity and no rebuild is needed.

reverbEnabled / vibratoEnabled default on. Tests assert each footswitch-off is a
bit-exact pass-through (equals the knob-at-zero render) and differs when engaged;
state round-trip and control-surface exposure updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 07:52:23 -07:00
parent c9795f7305
commit a9e91ef08c
2 changed files with 67 additions and 9 deletions
@@ -18,6 +18,10 @@ import LyrebirdUI
/// The amp's "vibrato" channel is historically amplitude modulation (tremolo), not pitch vibrato,
/// so `Intensity` drives a unipolar-sine gain LFO. Tremolo defaults off (`Intensity = 0`) so the
/// amp opens as a clean, reverbed platform.
///
/// A **Reverb** and a **Vibrato** switch model the amp's two-button footswitch: each bypasses its
/// effect (dry pass-through) while preserving the knob positions, so a player can stomp the FX in
/// and out without losing their settings.
public final class FullertonReverbAmpPedal: AmpVoicePedal {
// MARK: - Onboard-effect parameters
@@ -30,6 +34,12 @@ public final class FullertonReverbAmpPedal: AmpVoicePedal {
@UIParam public var intensity: Double = 0.0
/// Bright switch: `0` = flat, `1` = treble shelf engaged.
@UIParam public var bright: Double = 0.0
/// Reverb footswitch: `1` = reverb engaged, `0` = bypassed (dry pass-through, `Reverb` knob
/// setting preserved). Models the amp's reverb footswitch.
@UIParam public var reverbEnabled: Double = 1.0
/// Vibrato footswitch: `1` = tremolo engaged, `0` = bypassed (`Speed`/`Intensity` preserved).
/// Models the amp's vibrato footswitch.
@UIParam public var vibratoEnabled: Double = 1.0
// MARK: - Constants
@@ -46,8 +56,8 @@ public final class FullertonReverbAmpPedal: AmpVoicePedal {
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
private let intensityRange: ClosedRange<Double> = 0.0 ... 1.0
private let brightOffValue: Double = 0.0
private let brightOnValue: Double = 1.0
private let switchOffValue: Double = 0.0
private let switchOnValue: Double = 1.0
// MARK: - Voice configuration
@@ -86,8 +96,24 @@ public final class FullertonReverbAmpPedal: AmpVoicePedal {
label: "Bright",
node: $bright,
options: [
PedalSwitch.Option(title: "Off", value: brightOffValue),
PedalSwitch.Option(title: "On", value: brightOnValue),
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
PedalSwitch(
label: "Reverb",
node: $reverbEnabled,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
PedalSwitch(
label: "Vibrato",
node: $vibratoEnabled,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
]
@@ -104,12 +130,20 @@ public final class FullertonReverbAmpPedal: AmpVoicePedal {
}
/// Spring reverb → tremolo, inserted after the tone stack and before the power amp.
///
/// The `reverbEnabled` / `vibratoEnabled` footswitches gate each effect live by scaling its wet
/// amount to zero: reverb collapses to a dry pass-through and the tremolo LFO collapses to a
/// constant `1.0` (identity), each while preserving its knob positions and needing no rebuild.
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
// Footswitch gates the wet mix to 0 → SpringReverb passes the dry signal through.
let reverbMix: any ValidGeneratorInput = $reverb * $reverbEnabled
let reverbed: SpringReverb.Audio = SpringReverb.Audio(
input: signal, mix: $reverb, sampleRate: sampleRate)
// Unipolar sine LFO over [1 − intensity, 1]: peak gain 1.0, trough 1 − intensity.
let lfoScale: any ValidGeneratorInput = $intensity * tremoloDepthScale
let lfoOffset: any ValidGeneratorInput = 1.0 - ($intensity * tremoloDepthScale)
input: signal, mix: reverbMix, sampleRate: sampleRate)
// Footswitch gates depth to 0 → LFO is a constant 1.0. Unipolar sine over [1 − depth, 1]:
// peak gain 1.0, trough 1 − depth.
let depth: any ValidGeneratorInput = $intensity * $vibratoEnabled
let lfoScale: any ValidGeneratorInput = depth * tremoloDepthScale
let lfoOffset: any ValidGeneratorInput = 1.0 - (depth * tremoloDepthScale)
let lfo: OscSin.Audio = OscSin.Audio(freq: $speed, mul: lfoScale, add: lfoOffset)
return reverbed * lfo
}