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:
@@ -49,9 +49,6 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
|
||||
private let brightMaxGainDb: Double = 6.0
|
||||
/// Bright-switch shelf slope.
|
||||
private let brightSlope: Double = 0.8
|
||||
/// 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 reverbRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
|
||||
@@ -142,12 +139,7 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
|
||||
let reverbMix: any ValidGeneratorInput = $reverb * $reverbEnabled
|
||||
let reverbed: SpringReverb.Audio = SpringReverb.Audio(
|
||||
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
|
||||
// Tremolo gated by the vibrato footswitch (identity when depth·enabled == 0).
|
||||
return tremolo(reverbed, speed: $speed, depth: $intensity, enabled: $vibratoEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user