da2c3328ee
- Add a dedicated PedalCategory.cabinet (tweed tan), placed right after Amp Model, and remap the Cabinet pedal to it (was buried in EQ & Filter). Move "Cabinet" in the palette preferredOrder to just after the amps. - CabinetPedal is now double-width (widthUnits 2): three selectors (Cab / Mic / Mic B) crowded at single width, clipping the leading Cab caption and overlapping dials (a drag near the Mic/Mic B boundary could land on the neighbor's gesture — the "moving Mic moved Mic B" report). - Harden the selector-row ForEach: key by the (unique-per-pedal) selector label instead of the array offset, so each selector keeps a stable SwiftUI identity across board rebuilds and can't inherit a sibling's drag state. 669 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
3.6 KiB
Swift
64 lines
3.6 KiB
Swift
// PedalCategory.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import SwiftUI
|
|
|
|
/// A presentation grouping for pedals in the palette — used to colour-code the picker cards and to
|
|
/// drive the "filter by type" menu. Purely a UI concern: the mapping from a pedal's `displayName`
|
|
/// to its category lives here, keyed by name like ``PedalPaletteView``'s preferred order.
|
|
public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
|
|
case amp = "Amp Model"
|
|
case cabinet = "Cabinet"
|
|
case gain = "Gain"
|
|
case dynamics = "Dynamics"
|
|
case filter = "EQ & Filter"
|
|
case modulation = "Modulation"
|
|
case pitch = "Pitch"
|
|
case delay = "Delay"
|
|
case reverb = "Reverb"
|
|
case texture = "Texture"
|
|
|
|
public var id: String { rawValue }
|
|
|
|
/// Accent colour used to tint the palette card and the filter chip.
|
|
var color: Color {
|
|
switch self {
|
|
case .amp: return Color(red: 0.70, green: 0.45, blue: 0.18) // warm valve-glow copper
|
|
case .cabinet: return Color(red: 0.50, green: 0.36, blue: 0.18) // tweed / cabinet tan
|
|
case .gain: return Color(red: 0.82, green: 0.38, blue: 0.12)
|
|
case .dynamics: return Color(red: 0.20, green: 0.50, blue: 0.32)
|
|
case .filter: return Color(red: 0.14, green: 0.46, blue: 0.55)
|
|
case .modulation: return Color(red: 0.40, green: 0.34, blue: 0.74)
|
|
case .pitch: return Color(red: 0.60, green: 0.26, blue: 0.50)
|
|
case .delay: return Color(red: 0.10, green: 0.52, blue: 0.62)
|
|
case .reverb: return Color(red: 0.34, green: 0.22, blue: 0.66)
|
|
case .texture: return Color(red: 0.48, green: 0.42, blue: 0.30)
|
|
}
|
|
}
|
|
|
|
/// The category for a pedal `displayName`. Unknown (e.g. third-party) names fall back to
|
|
/// ``texture`` so they remain visible and tinted.
|
|
static func category(for displayName: String) -> PedalCategory {
|
|
mapping[displayName] ?? .texture
|
|
}
|
|
|
|
private static let mapping: [String: PedalCategory] = [
|
|
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Cali Hi-Gain": .amp, "Command": .amp, "Citrus": .amp, "Sixties Combo": .amp, "Magna Vibrato": .amp, "Anaheim": .amp, "Modern High-Gain": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Ivy League": .amp, "Fullerton Drive": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
|
|
"Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain,
|
|
"Compressor": .dynamics, "Sustainer": .dynamics, "Limiter": .dynamics, "Noise Gate": .dynamics,
|
|
"Graphic EQ": .filter, "Auto-Wah": .filter, "Wah": .filter, "Mutant": .filter,
|
|
"Cabinet": .cabinet,
|
|
"Tremolo": .modulation, "Phaser": .modulation, "Modulation": .modulation, "Chorus": .modulation,
|
|
"Flanger": .modulation, "Vibrato": .modulation, "Rotary": .modulation, "Ring Modulator": .modulation,
|
|
"Bass Octaver": .pitch, "Octave Splitter": .pitch, "Harmonizer": .pitch,
|
|
"Delay": .delay, "Feedback Delay": .delay, "Multi-Tap Delay": .delay, "Ping-Pong": .delay,
|
|
"Reverse Delay": .delay,
|
|
"Reverb": .reverb, "Shimmer Reverb": .reverb,
|
|
"Plate Reverb": .reverb, "Room Reverb": .reverb, "Spring Reverb": .reverb,
|
|
"Diffuser": .texture, "Bitcrusher": .texture, "Granulator": .texture, "Auto Granulator": .texture,
|
|
]
|
|
}
|