// BoutiqueODAmpPedal.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import LyrebirdSynth import LyrebirdUI /// Boutique **overdrive special** — the smooth D-style voice: a Fender-derived clean plus a fluid /// overdrive channel, a **Mid Boost** switch, a Master volume, and Presence / Depth shaping. /// /// A ``BoutiqueAmpPedal`` on the smoother American tone stack. The Mid Boost adds a midrange peak /// (the D-style "PAB" character) on top of the base Presence/Depth shaping. public final class BoutiqueODAmpPedal: BoutiqueAmpPedal { /// Mid Boost switch: `0` = flat, `1` = midrange peak engaged. @UIParam public var midBoost: Double = 0.0 private let midBoostFreqHz: Double = 650.0 private let midBoostMaxGainDb: Double = 6.0 private let midBoostQ: Double = 1.0 public override var toneStackModel: ToneStackModel { .fender } public override var summaryText: String { "Boutique overdrive special — smooth D-style OD with a Mid Boost, Master, Presence, and Depth." } /// Base Channel switch plus the Mid Boost switch (compose `super`). public override var effectSwitches: [PedalSwitch] { super.effectSwitches + [ PedalSwitch( label: "Mid Boost", node: $midBoost, options: [ PedalSwitch.Option(title: "Off", value: switchOffValue), PedalSwitch.Option(title: "On", value: switchOnValue), ] ), ] } /// Creates a Boutique OD 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: "Boutique OD", inputBus: inputBus, outputBus: outputBus) gain = 5.73 drive = 7.77 cab = 0.0 // American 1×12 } /// The base Presence/Depth shaping, plus a Mid Boost peak when the switch is engaged (its gain /// scales by the switch value, so Off is a true identity, live, no rebuild). public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { let shaped: any ValidGeneratorInput = super.shapeVoice(signal) let midGainDb: any ValidGeneratorInput = $midBoost * midBoostMaxGainDb return RBJPeakingEQ.Audio(input: shaped, freq: midBoostFreqHz, gain: midGainDb, q: midBoostQ) } }