651706126c
- BritishComboAmpPedal doc now covers the master-volume subclasses (was "non-master only"). - Hoist the duplicated leadBias (0.15) constant into BritishComboAmpPedal; British Master / Dual use the inherited one. - Test: assert British Dual's powerAmpOversample == 4. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
57 lines
2.5 KiB
Swift
57 lines
2.5 KiB
Swift
// 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
|
||
|
||
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)
|
||
}
|
||
}
|