Files
ShoeGaze/Sources/LyrebirdShoeGaze/Pedals/BritishMasterAmpPedal.swift
T
josh cda596b9d5 feat(amps): master-volume Marshalls — British Master / Dual (Phase 5)
Add a shared AmpVoicePedal.masterDrive(_:minDrive:maxDrive:) helper (Master knob
[0,1] → power-amp drive range) and route British's powerAmpDriveInput through it.
Two new BritishComboAmpPedal subclasses (Presence + Bright inherited):

- British Master — 800-series single-channel lead: preampStage cascades a second
  gain stage (both driven by Gain) + Master + 4× power-amp oversample.
- British Dual — 900/DSL: rebuildsOnChange Clean/Lead Channel switch (Lead
  cascades a stage set by Drive), Master, spring reverb; widthUnits 4.

Registered across 6 sites as .amp. 11 tests (Master drives power amp via
RMS-normalized SSD, cascaded-vs-Plexi, channel switch + rebuildsOnChange, drive/
reverb, ceiling on lead channel at max, control surfaces, round-trips, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 13:46:08 -07:00

59 lines
2.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// BritishMasterAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// British **master-volume lead** — the 800-series single-channel hot-rodded Marshall: a cascaded
/// two-stage preamp for singing lead gain, a Master volume, Presence, and a Bright switch.
///
/// A ``BritishComboAmpPedal`` (Presence + Bright) whose ``preampStage(_:)`` cascades a second gain
/// stage — both driven by `Gain`, so one knob sets the whole preamp grind — and whose `Master`
/// drives the power-amp stage (via ``AmpVoicePedal/masterDrive(_:minDrive:maxDrive:)``).
public final class BritishMasterAmpPedal: BritishComboAmpPedal {
/// Master volume in [0, 1] → power-amp drive in [`masterMinDrive`, `masterMaxDrive`].
@UIParam public var master: Double = 0.5
private let masterMinDrive: Double = 0.5
private let masterMaxDrive: Double = 5.0
/// Grid bias of the cascaded second preamp stage — a little asymmetry for even-harmonic grind.
private let leadBias: Double = 0.15
public override var summaryText: String {
"British master-volume lead — cascaded 800-series gain with Presence, Master, and Bright."
}
public override var signatureKnobs: [PedalKnob] {
super.signatureKnobs + [PedalKnob(label: "Master", node: $master, range: signatureRange)]
}
/// Master drives the power-amp stage. 4× oversampling since it can be driven hard.
public override var powerAmpDriveInput: any ValidGeneratorInput {
masterDrive($master, minDrive: masterMinDrive, maxDrive: masterMaxDrive)
}
public override var powerAmpOversample: Int { 4 }
/// Wider card for the Presence/Master knobs plus the Bright switch.
public override var widthUnits: Int { 3 }
/// Creates a British Master 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 Master", inputBus: inputBus, outputBus: outputBus)
gain = 5.0 // cascaded, so already a hot lead at moderate Gain
cab = 1.0 // British 4×12
}
/// Cascaded two-stage preamp: the base stage, then a second `TriodeStage` also driven by `Gain`.
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let stage1: any ValidGeneratorInput = super.preampStage(signal)
return TriodeStage(input: stage1, drive: $gain, bias: leadBias, oversample: preampOversample)
}
}