Files
ShoeGaze/Sources/LyrebirdShoeGaze/PedalSlider.swift
T
josh 69f50b2037 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>
2026-06-23 12:36:42 -07:00

47 lines
1.7 KiB
Swift

// PedalSlider.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdUI
/// A UI-agnostic description of one continuous vertical pedal fader.
///
/// Where ``PedalKnob`` describes a rotary control and ``PedalSwitch`` a discrete
/// segmented control, `PedalSlider` describes a continuous vertical fader — the control
/// a graphic EQ uses for its per-band gains and master output level. A `Pedal` publishes
/// an array of these via ``Pedal/effectSliders`` so a generic pedalboard UI can render a
/// bank of vertical faders without knowing the concrete pedal type.
///
/// Each descriptor pairs a display label with the live ``UIParamNode`` (the projected
/// value of an `@UIParam` property) and the value range the fader should span.
public struct PedalSlider {
/// Short label shown beneath the fader (e.g. "Low", "Gain").
public let label: String
/// The live parameter node the fader reads and writes. Pass `pedal.$paramName`.
public let node: UIParamNode
/// Inclusive value range the fader spans, in the parameter's own units.
public let range: ClosedRange<Double>
/// Creates a slider descriptor.
///
/// - Parameters:
/// - label: Short label shown beneath the fader.
/// - node: The `UIParamNode` projected value of an `@UIParam` property
/// (`pedal.$lowGain`, `pedal.$globalGain`, …).
/// - range: Inclusive value range the fader spans, in the parameter's units.
public init(
label: String,
node: UIParamNode,
range: ClosedRange<Double>
) {
self.label = label
self.node = node
self.range = range
}
}