Files
ShoeGaze/Sources/LyrebirdShoeGaze/PedalKnob.swift
T
2026-06-21 12:25:18 -07:00

44 lines
1.4 KiB
Swift

// PedalKnob.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdUI
/// A UI-agnostic description of one controllable pedal knob.
///
/// A `Pedal` publishes an array of these (via ``Pedal/knobs``) so a generic
/// pedalboard UI can render a rotary control per parameter 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 control should span.
public struct PedalKnob {
/// Short label shown beneath the knob (e.g. "Drive", "Mix").
public let label: String
/// The live parameter node the knob reads and writes. Pass `pedal.$paramName`.
public let node: UIParamNode
/// Inclusive value range the knob spans, in the parameter's own units.
public let range: ClosedRange<Double>
/// Creates a knob descriptor.
///
/// - Parameters:
/// - label: Short label shown beneath the knob.
/// - node: The `UIParamNode` projected value of an `@UIParam` property
/// (`pedal.$drive`, `pedal.$mix`, …).
/// - range: Inclusive value range the knob spans, in the parameter's units.
public init(
label: String,
node: UIParamNode,
range: ClosedRange<Double>
) {
self.label = label
self.node = node
self.range = range
}
}