feat(amps): channel-switch enabler + drive-channel amps (Phase 4)

Enabler:
- PedalSwitch.rebuildsOnChange (mirrors PedalSelectorKnob): a switch that changes
  graph topology asks the host to rebuild. Wired through PedalSwitchView (onCommit
  on a changed tap) and PedalView.switchRow → pedalRebuildAction.
- AmpVoicePedal.preampStage(_:) overridable hook (default: one TriodeStage at
  Gain). preCabinetCore feeds it; a channel amp cascades an extra stage on its
  drive channel. Named preampOversample constant (4).

Amps:
- Fullerton Drive — American two-channel combo: blackface Clean + an overdrive
  channel (cascaded TriodeStage set by Drive), spring reverb, Bright. Channel
  switch is rebuildsOnChange, so only the selected channel's stages are built.
- Jazz Clean — add the JC onboard Distortion channel (Clean/Dist switch + Drive
  knob) via the same preampStage cascade; flows through its stereo wideEffect.

Registered Fullerton Drive across 6 sites as .amp. 22 tests across the two amps
(channel switch changes output, drive knob, rebuildsOnChange, ceiling on the
drive channel, control surface, round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 13:04:06 -07:00
parent 8cd77ad984
commit da4d5e23ea
12 changed files with 327 additions and 10 deletions
@@ -38,6 +38,10 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
@UIParam public var bright: Double = 0.0
/// Chorus footswitch: `1` = chorus engaged (stereo), `0` = bypassed (dry, mono-equivalent).
@UIParam public var chorusEnabled: Double = 1.0
/// Drive-channel preamp gain (the onboard distortion). Range [1, 30].
@UIParam public var drive: Double = 8.0
/// Channel select: `0` = Clean, `1` = Distortion (the cascaded onboard-distortion stage).
@UIParam public var channel: Double = 0.0
// MARK: - Constants
@@ -50,9 +54,15 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
/// Fixed chorus wet/dry blend when the chorus is engaged (the amp has no chorus-mix knob).
private let chorusMixValue: Double = 0.5
/// Grid bias of the cascaded distortion stage — solid-state-flavoured, near-symmetric.
private let driveBias: Double = 0.1
/// Channel-select threshold: `>= this` selects the Distortion channel.
private let channelThreshold: Double = 0.5
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
private let chorusRateRange: ClosedRange<Double> = 0.1 ... 5.0
private let chorusDepthRange: ClosedRange<Double> = 0.0005 ... 0.015
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
private let switchOffValue: Double = 0.0
private let switchOnValue: Double = 1.0
@@ -60,13 +70,14 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
public override var toneStackModel: ToneStackModel { .fender }
public override var summaryText: String {
"Solid-state clean — lush stereo chorus, spring reverb, and a Bright switch."
"Solid-state clean — lush stereo chorus, spring reverb, a Bright switch, and a Distortion channel."
}
public override var signatureKnobs: [PedalKnob] {
[
PedalKnob(label: "Reverb", node: $reverb, range: reverbRange),
PedalKnob(label: "Rate", node: $chorusRate, range: chorusRateRange),
PedalKnob(label: "Depth", node: $chorusDepth, range: chorusDepthRange),
PedalKnob(label: "Drive", node: $drive, range: driveRange),
]
}
@@ -109,9 +120,27 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
PedalSwitch(
label: "Channel",
node: $channel,
options: [
PedalSwitch.Option(title: "Clean", value: switchOffValue),
PedalSwitch.Option(title: "Dist", value: switchOnValue),
],
rebuildsOnChange: true
),
]
}
/// Clean preamp, plus the onboard-distortion stage on the Distortion channel. The `channel`
/// value is read at board-build time (the switch is `rebuildsOnChange`), so only the selected
/// channel's stages exist in the graph.
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let clean: any ValidGeneratorInput = super.preampStage(signal)
guard channel >= channelThreshold else { return clean }
return TriodeStage(input: clean, drive: $drive, bias: driveBias, oversample: preampOversample)
}
// MARK: - Hooks
/// Bright switch: a high-shelf lift ahead of the preamp (identity when off, live, no rebuild).