Add Limiter, Noise Gate, and Graphic EQ pedals + vertical-fader UI control
Three new pedals: - LimiterPedal: linear boost gain stage into a LookAheadLimiter brick-wall ceiling. Reads engine sampleRate injected by PedalBoard.add at build time. - NoiseGatePedal: AmplitudeFollower -> hysteretic Schmidt gate -> LinLin floor map -> Lag smoothing. Tuneable residual floor when the gate is closed. - GraphicEQPedal: five cascaded RBJ filters (low/high shelf + three peaking mids) with per-band dB gains and a linear master output gain. New UI control: - PedalSlider descriptor and Pedal.effectSliders hook, alongside effectKnobs and effectSwitches. - VerticalParameterSlider: a vertical fader bound to a UIParamNode. - PedalView renders the fader bank and widens the enclosure to fit it. Persistence/registry: - PedalState.sliderValues (decodeIfPresent for backward compatibility); capture and apply in Pedal+Preset. - Registry entries and palette ordering for all three pedals. Tests: non-silent builds, limiter ceiling enforcement, gate open/closed/unity floor power ratios, EQ flat output, global-gain scaling, and 6-slider preset round-trip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,10 @@ public struct PedalState: Codable, Equatable {
|
||||
/// no switches. Absent in presets saved before switches existed — decodes to `[]`.
|
||||
public let switchValues: [Double]
|
||||
|
||||
/// Slider values in the same order as `Pedal.effectSliders`. Empty for pedals with
|
||||
/// no sliders. Absent in presets saved before sliders existed — decodes to `[]`.
|
||||
public let sliderValues: [Double]
|
||||
|
||||
/// Bypass parameter value. `0.0` = engaged, `1.0` = bypassed.
|
||||
public let bypass: Double
|
||||
|
||||
@@ -35,16 +39,19 @@ public struct PedalState: Codable, Equatable {
|
||||
/// - type: The pedal's `displayName`, used to identify the pedal type on load.
|
||||
/// - knobValues: Current knob values in `Pedal.knobs` order.
|
||||
/// - switchValues: Current switch values in `Pedal.effectSwitches` order. Defaults to empty.
|
||||
/// - sliderValues: Current slider values in `Pedal.effectSliders` order. Defaults to empty.
|
||||
/// - bypass: Bypass parameter value (`0.0` = engaged, `1.0` = bypassed).
|
||||
public init(
|
||||
type: String,
|
||||
knobValues: [Double],
|
||||
switchValues: [Double] = [],
|
||||
sliderValues: [Double] = [],
|
||||
bypass: Double
|
||||
) {
|
||||
self.type = type
|
||||
self.knobValues = knobValues
|
||||
self.switchValues = switchValues
|
||||
self.sliderValues = sliderValues
|
||||
self.bypass = bypass
|
||||
}
|
||||
|
||||
@@ -52,16 +59,18 @@ public struct PedalState: Codable, Equatable {
|
||||
case type
|
||||
case knobValues
|
||||
case switchValues
|
||||
case sliderValues
|
||||
case bypass
|
||||
}
|
||||
|
||||
/// Decodes a snapshot, tolerating presets saved before `switchValues` existed by
|
||||
/// defaulting the missing key to an empty array.
|
||||
/// Decodes a snapshot, tolerating presets saved before `switchValues` / `sliderValues`
|
||||
/// existed by defaulting the missing keys to an empty array.
|
||||
public init(from decoder: any Decoder) throws {
|
||||
let container: KeyedDecodingContainer<CodingKeys> = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.type = try container.decode(String.self, forKey: .type)
|
||||
self.knobValues = try container.decode([Double].self, forKey: .knobValues)
|
||||
self.switchValues = try container.decodeIfPresent([Double].self, forKey: .switchValues) ?? []
|
||||
self.sliderValues = try container.decodeIfPresent([Double].self, forKey: .sliderValues) ?? []
|
||||
self.bypass = try container.decode(Double.self, forKey: .bypass)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user