Files
josh 1f5b70edc7 feat(undo): parameter undo for knobs, sliders, switches, selectors
Tier 2 of the rig-undo feature, on the same undo stack as the structural
(tier 1) edits. Records one undo checkpoint when the user finishes changing a
pedal control, so ⌘Z / the ↶ button step back through knob turns and switch
flips as well as add/remove/move.

- UndoEntry.parameter + PedalControlGroup (knob/advancedKnob/slider/switch/
  selector); UndoCoordinator.recordParameterEdit + .parameter handling in
  undo()/redo(). applyParameter re-resolves the LIVE node by (pedalID, group,
  controlLabel) via ShoeGaze.pedal(id:), so an undo lands on the right control
  even after an intervening structural rebuild replaced the pedal's node
  (pedal ids persist through rebuild). old == new records nothing.
- Knobs record via Lyrebird 2.3.0's ParameterKnob.onEditingEnded (one edit per
  drag): PedalView.recordingKnob (main / advanced / mix / level / looper) and
  TempoSyncKnobView.
- Self-contained views (VerticalParameterSlider, PedalSwitchView,
  PedalSelectorKnobView) record via a new \.pedalParameterEditRecorder
  environment closure PedalView installs, capturing pedal.id + the coordinator.
  Slider/selector snapshot node.value at drag start; switch records old→new on
  the committing tap.
- rebuildsOnChange switches/selectors are deliberately NOT recorded (they alter
  graph topology and would fight the structural restore's live-value merge) —
  documented as a known gap, along with tempo-sync division changes.
- Bump the Lyrebird pin to 2.3.0 (the released tag with onEditingEnded), drop
  the dev-time local path override.

Tests: 18 UndoCoordinator tests (knob/slider/switch/selector round-trips,
post-rebuild re-resolution, + a catalogue test asserting unique control labels
per group so the by-label resolution can't mis-target). Full suite 837 green;
both demo schemes build against 2.3.0. External review + caveman sweep: no
blocking findings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-25 14:23:00 -08:00

66 lines
2.8 KiB
Swift

// swift-tools-version: 6.0
// ShoeGaze — a standalone guitar-pedalboard sample project for Lyrebird.
//
// Depends on the published Lyrebird package by URL. Two products:
// • LyrebirdShoeGaze — core pedal/board framework (no SwiftUI).
// • LyrebirdShoeGazeUI — SwiftUI pedalboard views (knobs + bypass toggle).
//
// Linkage note: both targets link the *static* Lyrebird products (`Lyrebird`,
// `LyrebirdUI`). SwiftPM resolves the shared `LyrebirdSynth` target once, so
// there is a single copy of the module in any consumer — no ObjC class
// double-registration. The dynamic-product dance used by `LiveCompile/` is only
// required for runtime dylib hot-swap, which ShoeGaze does not do.
//
// The apps live at Demo/ShoeGazeBuilder.xcodeproj (macOS) and
// Demo/ShoeGazeBuilderiOS.xcodeproj (iPad) — open ShoeGaze.xcworkspace in Xcode
// and run the matching scheme to build them.
import PackageDescription
let package = Package(
name: "LyrebirdShoeGaze",
platforms: [.macOS(.v15), .iOS(.v18)],
products: [
.library(name: "LyrebirdShoeGaze", targets: ["LyrebirdShoeGaze"]),
.library(name: "LyrebirdShoeGazeUI", targets: ["LyrebirdShoeGazeUI"]),
],
dependencies: [
.package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "2.3.0"),
],
targets: [
// Both targets depend on the core `Lyrebird` product AND `LyrebirdUI`.
// Pedals expose their knobs as `@UIParam`, whose projected `UIParamNode`
// lives in the core `LyrebirdSynth` module (the `Lyrebird` product) as of
// Lyrebird 2.0 — `LyrebirdUI` no longer re-exports it — so any file using
// `@UIParam` / `UIParamNode` needs `import LyrebirdSynth`, which requires
// the `Lyrebird` product as a direct dependency. Importing these does not
// pull SwiftUI into ShoeGaze's own core sources.
.target(
name: "LyrebirdShoeGaze",
dependencies: [
.product(name: "Lyrebird", package: "Lyrebird"),
.product(name: "LyrebirdUI", package: "Lyrebird"),
],
path: "Sources/LyrebirdShoeGaze"
),
.target(
name: "LyrebirdShoeGazeUI",
dependencies: [
"LyrebirdShoeGaze",
.product(name: "Lyrebird", package: "Lyrebird"),
.product(name: "LyrebirdUI", package: "Lyrebird"),
],
path: "Sources/LyrebirdShoeGazeUI"
),
.testTarget(
name: "LyrebirdShoeGazeTests",
dependencies: [
"LyrebirdShoeGaze",
"LyrebirdShoeGazeUI",
.product(name: "Lyrebird", package: "Lyrebird"),
.product(name: "LyrebirdUI", package: "Lyrebird"),
],
path: "Tests/LyrebirdShoeGazeTests"
),
]
)