refactor(amps): shared tremolo helper (dedup across 3 combo amps)
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>
This commit is contained in:
@@ -47,10 +47,6 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
|
||||
private let brilliantMaxGainDb: Double = 6.0
|
||||
/// Brilliant-switch shelf slope.
|
||||
private let brilliantSlope: Double = 0.7
|
||||
/// Tremolo depth scaling — at full `intensity` the LFO swings over half the normalised range so
|
||||
/// the peak gain is 1.0 and the trough is `1 − intensity`.
|
||||
private let tremoloDepthScale: Double = 0.5
|
||||
|
||||
private let cutRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
|
||||
private let intensityRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
@@ -121,13 +117,8 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
|
||||
|
||||
/// Tremolo (gated by the Tremolo footswitch), inserted after the tone stack. No onboard reverb.
|
||||
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
// Footswitch gates depth to 0 → LFO is a constant 1.0 (identity). Unipolar sine over
|
||||
// [1 − depth, 1]: peak gain 1.0, trough 1 − depth.
|
||||
let depth: any ValidGeneratorInput = $intensity * $tremoloEnabled
|
||||
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 signal * lfo
|
||||
// Tremolo gated by the Tremolo footswitch (identity when depth·enabled == 0).
|
||||
tremolo(signal, speed: $speed, depth: $intensity, enabled: $tremoloEnabled)
|
||||
}
|
||||
|
||||
/// Cut control: a low-pass whose cutoff sweeps from `cutOpenHz` (bright) down to `cutDarkHz`
|
||||
|
||||
Reference in New Issue
Block a user