feat(ui): amp-head layout + Neural Amp model loader (S4)
- 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>
This commit is contained in:
@@ -670,6 +670,18 @@ public struct ShoeGazeBuilderView: View {
|
||||
// Feed the rig's control map into the board tree so each pedal can draw its mapping strip.
|
||||
// Reading `shoeGaze.midiMap` here (observable) refreshes every strip when a binding changes.
|
||||
.environment(\.controlMappingMap, shoeGaze.midiMap)
|
||||
// Let a pedal (e.g. Neural Amp on a model-file change) request a rebuild of its board.
|
||||
// Captures only `shoeGaze` (a @MainActor session); `rebuildBoard` is safe on a running
|
||||
// engine (at most one block of glitch).
|
||||
.environment(\.pedalRebuildAction, { @MainActor [shoeGaze] (pedal: Pedal) in
|
||||
// Branch-aware lookup — the pedal may live inside a parallel / stereo-split section.
|
||||
guard let board: PedalBoard = shoeGaze.board(containing: pedal) else { return }
|
||||
do {
|
||||
_ = try shoeGaze.rebuildBoard(board, from: board.captureState())
|
||||
} catch {
|
||||
print("[ShoeGaze] board rebuild after model change failed: \(error)")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: - Compact layout (iPhone / narrow iPad)
|
||||
|
||||
Reference in New Issue
Block a user