a7534a29db
Factor the duplicated unipolar-sine tremolo block out of Fullerton Reverb, Chime Top Boost, and British Bluesbreaker onboardEffects into one shared AmpVoicePedal.tremolo(_:speed:depth:enabled:) — signal × LFO over [1 − depth·enabled, 1], a bit-exact identity when depth·enabled == 0. The 0.5 depth scale is a single named constant on the base. Same expression tree as before, so no behavior change — the footswitch bit-exact bypass tests and the full 589-test suite stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
73 lines
3.0 KiB
Swift
73 lines
3.0 KiB
Swift
// BritishBluesbreakerAmpPedal.swift
|
||
// Lyrebird
|
||
//
|
||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||
// SPDX-License-Identifier: MIT
|
||
|
||
import LyrebirdSynth
|
||
import LyrebirdUI
|
||
|
||
/// British non-master **2×12 combo** with onboard **tremolo** — the bluesbreaker voice: lower-power
|
||
/// Marshall crunch that cleans up with the guitar volume, plus a bias-tremolo.
|
||
///
|
||
/// A ``BritishComboAmpPedal`` (Presence + Bright) that overlays a tremolo in the onboard-effects
|
||
/// slot, with Speed / Intensity knobs and a Tremolo footswitch.
|
||
public final class BritishBluesbreakerAmpPedal: BritishComboAmpPedal {
|
||
|
||
/// Tremolo LFO rate in Hz. Range [0.5, 12].
|
||
@UIParam public var speed: Double = 4.0
|
||
/// Tremolo depth in [0, 1]. `0` = off, `1` = full swing.
|
||
@UIParam public var intensity: Double = 0.0
|
||
/// Tremolo footswitch: `1` = engaged, `0` = bypassed (`Speed`/`Intensity` preserved).
|
||
@UIParam public var tremoloEnabled: Double = 1.0
|
||
|
||
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
|
||
private let intensityRange: ClosedRange<Double> = 0.0 ... 1.0
|
||
|
||
public override var summaryText: String {
|
||
"British 2×12 combo — bluesbreaker crunch with tremolo, Presence, and a Bright switch."
|
||
}
|
||
|
||
public override var signatureKnobs: [PedalKnob] {
|
||
[
|
||
PedalKnob(label: "Presence", node: $presence, range: signatureRange),
|
||
PedalKnob(label: "Speed", node: $speed, range: speedRange),
|
||
PedalKnob(label: "Intensity", node: $intensity, range: intensityRange),
|
||
]
|
||
}
|
||
|
||
/// Wider card for the extra tremolo knobs plus the Bright and Tremolo switches.
|
||
public override var widthUnits: Int { 3 }
|
||
|
||
/// The base Bright switch plus a Tremolo footswitch (compose `super` so Bright stays in sync).
|
||
public override var effectSwitches: [PedalSwitch] {
|
||
super.effectSwitches + [
|
||
PedalSwitch(
|
||
label: "Tremolo",
|
||
node: $tremoloEnabled,
|
||
options: [
|
||
PedalSwitch.Option(title: "Off", value: switchOffValue),
|
||
PedalSwitch.Option(title: "On", value: switchOnValue),
|
||
]
|
||
),
|
||
]
|
||
}
|
||
|
||
/// Creates a British Bluesbreaker amp.
|
||
///
|
||
/// - Parameters:
|
||
/// - inputBus: Audio bus index to read the dry input from. Defaults to `0`.
|
||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||
super.init(name: "British Bluesbreaker", inputBus: inputBus, outputBus: outputBus)
|
||
gain = 6.0
|
||
cab = 1.0 // British 4×12 voice (combo 2×12 tonally close enough among our cabs)
|
||
}
|
||
|
||
/// Tremolo (gated by the Tremolo footswitch), inserted after the tone stack.
|
||
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||
// Identity when depth·enabled == 0.
|
||
tremolo(signal, speed: $speed, depth: $intensity, enabled: $tremoloEnabled)
|
||
}
|
||
}
|