23d607b9fc
- AmpPedal: double-width (widthUnits 2) amp-head card so the four tone knobs + Amp/Cab selectors + master aren't cramped. Uses the generic single-column content (no greedy Spacers → no flow-canvas height issue). - Neural Amp model loader: PedalView renders, for a NeuralAmpPedal, a "Load Model…" picker (.fileImporter for .json) plus the loaded model's filename. Picking sets Pedal.resourcePath and asks the host to rebuild the board so the model applies live. Picker + AppKit stay in the UI layer (core imports none). - New `pedalRebuildAction` environment value (@MainActor @Sendable), installed by ShoeGazeBuilderView; it resolves the pedal's board via a new branch-aware `ShoeGaze.board(containing:)` (finds pedals inside parallel / stereo-split branches, not just the main chain) and rebuilds it via the live-safe `rebuildBoard(_:from:)`. Tests: AmpPedal widthUnits == 2; board(containing:) finds main + branch pedals and returns nil for a stranger. Full suite 502. (SwiftUI loader flow needs on-device visual QA.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
1000 B
Swift
25 lines
1000 B
Swift
// PedalRebuildEnvironment.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import SwiftUI
|
|
import LyrebirdShoeGaze
|
|
|
|
/// Environment action a leaf pedal control can call to ask the host to rebuild the board that
|
|
/// contains the given pedal — needed when a pedal setting that is *not* a live `@UIParam` (e.g.
|
|
/// the Neural Amp's model file, stored in ``Pedal/resourcePath``) changes and only takes effect
|
|
/// after the pedal's graph is rebuilt. Set once near the builder root; defaults to a no-op.
|
|
private struct PedalRebuildActionKey: EnvironmentKey {
|
|
static let defaultValue: @MainActor @Sendable (Pedal) -> Void = { _ in }
|
|
}
|
|
|
|
extension EnvironmentValues {
|
|
/// Rebuilds the board containing the passed pedal. No-op unless the host installs it.
|
|
var pedalRebuildAction: @MainActor @Sendable (Pedal) -> Void {
|
|
get { self[PedalRebuildActionKey.self] }
|
|
set { self[PedalRebuildActionKey.self] = newValue }
|
|
}
|
|
}
|