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:
@@ -49,6 +49,10 @@ public final class AmpPedal: Pedal {
|
||||
/// The amp is fully wet (it replaces the dry signal); hide the Mix control.
|
||||
public override var showsMixControl: Bool { false }
|
||||
|
||||
/// Amp-head-style double-width card so the four tone knobs plus the Amp / Cab selectors and
|
||||
/// master lay out with room, rather than cramping into a single-width stompbox.
|
||||
public override var widthUnits: Int { 2 }
|
||||
|
||||
// MARK: - Parameters
|
||||
|
||||
/// Preamp drive into the first tube stage. Range [1, 30].
|
||||
|
||||
@@ -248,6 +248,16 @@ public final class ShoeGaze {
|
||||
return result
|
||||
}
|
||||
|
||||
/// The top-level board that contains `pedal`, searching the main chain **and** parallel /
|
||||
/// stereo-split branch sections. Returns `nil` if the pedal isn't in a main board (e.g. it
|
||||
/// lives in a chain-router branch, which `rebuildBoard(_:from:)` doesn't operate on).
|
||||
///
|
||||
/// Used by the UI to rebuild the right board after a non-`@UIParam` pedal change (e.g. the
|
||||
/// Neural Amp loading a model file).
|
||||
public func board(containing pedal: Pedal) -> PedalBoard? {
|
||||
boards.first { board in pedals(in: board).contains { $0 === pedal } }
|
||||
}
|
||||
|
||||
/// Every live `Pedal` in one board, including pedals inside its parallel and stereo-split
|
||||
/// branch sections (branch pedals live in their section objects, not as top-level segments).
|
||||
private func pedals(in board: PedalBoard) -> [Pedal] {
|
||||
|
||||
Reference in New Issue
Block a user