8c701af128
A .widener pedal that splits the dry signal into overlapping RBJ band-pass bands and pans each by frequency (low to left, high to right); the spread knob fans the spectrum from mono (spread 0) to a wide diffuse image (spread 1), using linear pan expressed purely as node arithmetic. Registered, with PedalType.diffuser, enclosure color, palette order, summary, and tests (non-silent stereo; L == R at spread 0; L != R at full spread). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
2.8 KiB
Swift
80 lines
2.8 KiB
Swift
// PedalType.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/// A type-safe identifier for a pedal type, used by the board-edit API instead of a raw string.
|
|
///
|
|
/// `PedalType` is an extensible token (the `RawRepresentable` struct pattern, à la
|
|
/// `Notification.Name`): the built-in pedals are exposed as static members for discoverable,
|
|
/// autocompleting call sites —
|
|
///
|
|
/// ```swift
|
|
/// try shoeGaze.appendPedal(.overdrive, to: board)
|
|
/// ```
|
|
///
|
|
/// — while staying open for custom pedals, since any `PedalType("My Pedal")` is valid and a
|
|
/// third party can add their own static members in an extension.
|
|
///
|
|
/// `rawValue` is the pedal's `displayName`, which is exactly what the rig save format stores
|
|
/// (`PedalState.type`) and what ``PedalRegistry`` keys on. `PedalType` therefore changes only the
|
|
/// authoring call site — the JSON format and load path are unchanged.
|
|
///
|
|
/// > Note: named `PedalType` rather than `PedalKind` to avoid colliding with Lyrebird's
|
|
/// > score-notation `PedalKind` enum, which is visible whenever both modules are imported.
|
|
public struct PedalType: RawRepresentable, Hashable, Sendable {
|
|
|
|
/// The pedal's `displayName`; the key used by ``PedalRegistry`` and stored in saved rigs.
|
|
public let rawValue: String
|
|
|
|
/// Creates a type from a raw `displayName` string.
|
|
public init(rawValue: String) {
|
|
self.rawValue = rawValue
|
|
}
|
|
|
|
/// Creates a type from a raw `displayName` string.
|
|
public init(_ rawValue: String) {
|
|
self.rawValue = rawValue
|
|
}
|
|
}
|
|
|
|
// MARK: - Built-in pedals
|
|
|
|
public extension PedalType {
|
|
|
|
// Drive & dynamics
|
|
static let overdrive = PedalType("Overdrive")
|
|
static let fuzz = PedalType("Fuzz")
|
|
static let compressor = PedalType("Compressor")
|
|
static let limiter = PedalType("Limiter")
|
|
static let noiseGate = PedalType("Noise Gate")
|
|
|
|
// EQ & filter
|
|
static let graphicEQ = PedalType("Graphic EQ")
|
|
static let autoWah = PedalType("Auto-Wah")
|
|
static let mutant = PedalType("Mutant")
|
|
static let phaser = PedalType("Phaser")
|
|
|
|
// Modulation
|
|
static let tremolo = PedalType("Tremolo")
|
|
static let modulation = PedalType("Modulation")
|
|
static let chorus = PedalType("Chorus")
|
|
static let ringModulator = PedalType("Ring Modulator")
|
|
static let diffuser = PedalType("Diffuser")
|
|
|
|
// Dynamics (additional)
|
|
static let sustainer = PedalType("Sustainer")
|
|
|
|
// Delay & reverb
|
|
static let delay = PedalType("Delay")
|
|
static let feedbackDelay = PedalType("Feedback Delay")
|
|
static let multiTapDelay = PedalType("Multi-Tap Delay")
|
|
static let pingPong = PedalType("Ping-Pong")
|
|
static let reverb = PedalType("Reverb")
|
|
|
|
// Pitch & octave
|
|
static let octaveSplitter = PedalType("Octave Splitter")
|
|
static let bassOctaver = PedalType("Bass Octaver")
|
|
}
|