// CaliHiGainAmpPedal.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import LyrebirdSynth import LyrebirdUI /// California **Mark-series high-gain** — the cascaded lead voice defined by its onboard **5-band /// graphic EQ**: the sliders sculpt the famous scooped "V" lead tone on top of the amp's own gain. /// /// A ``BoutiqueAmpPedal`` (Clean/Lead channel, Master, Presence, Depth) that adds a graphic-EQ bank /// in ``shapeVoice(_:)`` — a low shelf, three peaks, and a high shelf, each a dB fader — cascaded /// after the base Presence/Depth shaping. Defaults to a gentle V. public final class CaliHiGainAmpPedal: BoutiqueAmpPedal { /// Graphic-EQ band gains in dB, range [-12, 12]. Defaults form a mild scooped "V" — the /// Mark-series signature. /// 80 Hz low-shelf gain in dB. @UIParam public var eq80: Double = 2.0 /// 240 Hz peaking gain in dB. @UIParam public var eq240: Double = 0.0 /// 750 Hz peaking gain in dB (the mid-scoop band). @UIParam public var eq750: Double = -5.0 /// 2.2 kHz peaking gain in dB. @UIParam public var eq2200: Double = 0.0 /// 6.6 kHz high-shelf gain in dB. @UIParam public var eq6600: Double = 3.0 private let eq80Freq: Double = 80.0 private let eq240Freq: Double = 240.0 private let eq750Freq: Double = 750.0 private let eq2200Freq: Double = 2200.0 private let eq6600Freq: Double = 6600.0 /// Shelf slope for the outer graphic-EQ bands. private let eqShelfSlope: Double = 1.0 /// Peaking-band Q — moderate bandwidth so adjacent graphic-EQ bands overlap smoothly. private let eqPeakQ: Double = 0.9 private let bandGainRange: ClosedRange = -12.0 ... 12.0 public override var toneStackModel: ToneStackModel { .fender } public override var summaryText: String { "California Mark-series high gain with an onboard 5-band graphic EQ (scooped-V lead)." } /// The five graphic-EQ bands as vertical faders (dB), rendered as a slider bank. public override var effectSliders: [PedalSlider] { [ PedalSlider(label: "80", node: $eq80, range: bandGainRange), PedalSlider(label: "240", node: $eq240, range: bandGainRange), PedalSlider(label: "750", node: $eq750, range: bandGainRange), PedalSlider(label: "2.2k", node: $eq2200, range: bandGainRange), PedalSlider(label: "6.6k", node: $eq6600, range: bandGainRange), ] } /// Creates a Cali Hi-Gain 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: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus) gain = 6.0 drive = 16.0 // hot Mark-style lead cab = 1.0 // British 4×12 — tight and aggressive } /// Base Presence/Depth shaping, then the 5-band graphic EQ (low shelf → 3 peaks → high shelf), /// each band's gain in dB from its fader. public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { let shaped: any ValidGeneratorInput = super.shapeVoice(signal) let low: RBJLowShelf.Audio = RBJLowShelf.Audio( input: shaped, freq: eq80Freq, gain: $eq80, slope: eqShelfSlope) let lowMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( input: low, freq: eq240Freq, gain: $eq240, q: eqPeakQ) let mid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( input: lowMid, freq: eq750Freq, gain: $eq750, q: eqPeakQ) let highMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( input: mid, freq: eq2200Freq, gain: $eq2200, q: eqPeakQ) return RBJHighShelf.Audio( input: highMid, freq: eq6600Freq, gain: $eq6600, slope: eqShelfSlope) } }