Add board mixer bar UI + independent per-board audibility API

Multi-board playback was all-or-one: selectBoard soloed exclusively,
selectAllBoards summed. There was no way to play an arbitrary subset, and
the builder only exposed a dropdown that picked which board to *edit*.

ShoeGaze API:
- setBoard(_:audible:crossfadeSeconds:) toggles one board's select-gain in
  place without disturbing the others (Blend mixing); clears activeBoardIndex.
- soloBoard(_:crossfadeSeconds:) — the "Solo" verb (wraps selectBoard).
- isBoardAudible(_:) reports a board's live select-gain target.

UI — BoardBarView (shared macOS/iOS):
- Horizontal board-mixer strip. Each board is a channel cell: audible LED,
  Solo button, and a master-gain fader. Tapping a cell name sets the edit
  target (independent of what's audible); context menu silences/deletes.
- Solo | Blend mode switch + an All button + a crossfade slider.
- Replaces the builder's board dropdown and Add Board button; the cell's +
  adds a board.

Tests: solo/blend/all audibility transitions and activeBoardIndex tracking;
setBoard no-op for a board owned by another manager.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 16:51:17 -07:00
parent cdac587454
commit c0605d295d
4 changed files with 440 additions and 17 deletions
@@ -39,6 +39,86 @@ struct ShoeGazeMultiBoardTests {
#expect(shoeGaze.boards.count == 2)
}
@Test func soloBlendAndAllControlBoardAudibility() throws {
let renderDuration: Double = 0.05
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
duration: renderDuration,
numAudioBuses: 64
)
defer { try? FileManager.default.removeItem(at: url) }
let shoeGaze: ShoeGaze = ShoeGaze(engine: engine)
let board1: PedalBoard = try shoeGaze.addBoard()
try board1.add(OverdrivePedal())
try shoeGaze.finalizeBoard(board1)
let board2: PedalBoard = try shoeGaze.addBoard()
try board2.add(DelayPedal())
try shoeGaze.finalizeBoard(board2)
let board3: PedalBoard = try shoeGaze.addBoard()
try board3.add(OverdrivePedal())
try shoeGaze.finalizeBoard(board3)
let instantCrossfade: Double = 0.0
// Default: every board audible, no solo.
#expect(shoeGaze.isBoardAudible(board1))
#expect(shoeGaze.isBoardAudible(board2))
#expect(shoeGaze.isBoardAudible(board3))
#expect(shoeGaze.activeBoardIndex == nil)
// Solo board2 — exclusive.
shoeGaze.soloBoard(board2, crossfadeSeconds: instantCrossfade)
#expect(!shoeGaze.isBoardAudible(board1))
#expect(shoeGaze.isBoardAudible(board2))
#expect(!shoeGaze.isBoardAudible(board3))
#expect(shoeGaze.activeBoardIndex == 1)
// Blend: re-enable board1 without disturbing the others, and clear the solo index.
shoeGaze.setBoard(board1, audible: true, crossfadeSeconds: instantCrossfade)
#expect(shoeGaze.isBoardAudible(board1))
#expect(shoeGaze.isBoardAudible(board2))
#expect(!shoeGaze.isBoardAudible(board3))
#expect(shoeGaze.activeBoardIndex == nil)
// Silence a single board.
shoeGaze.setBoard(board1, audible: false, crossfadeSeconds: instantCrossfade)
#expect(!shoeGaze.isBoardAudible(board1))
#expect(shoeGaze.isBoardAudible(board2))
// All back to summed.
shoeGaze.selectAllBoards(crossfadeSeconds: instantCrossfade)
#expect(shoeGaze.isBoardAudible(board1))
#expect(shoeGaze.isBoardAudible(board2))
#expect(shoeGaze.isBoardAudible(board3))
#expect(shoeGaze.activeBoardIndex == nil)
}
@Test func setBoardIgnoresUnmanagedBoard() throws {
let renderDuration: Double = 0.05
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(duration: renderDuration, numAudioBuses: 64)
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(duration: renderDuration, numAudioBuses: 64)
defer {
try? FileManager.default.removeItem(at: urlA)
try? FileManager.default.removeItem(at: urlB)
}
let shoeGazeA: ShoeGaze = ShoeGaze(engine: engineA)
let shoeGazeB: ShoeGaze = ShoeGaze(engine: engineB)
let boardA: PedalBoard = try shoeGazeA.addBoard()
try boardA.add(OverdrivePedal())
try shoeGazeA.finalizeBoard(boardA)
let boardB: PedalBoard = try shoeGazeB.addBoard()
try boardB.add(DelayPedal())
try shoeGazeB.finalizeBoard(boardB)
// Toggling a board not owned by this manager is a no-op and must not change state.
shoeGazeA.setBoard(boardB, audible: false, crossfadeSeconds: 0.0)
#expect(shoeGazeA.isBoardAudible(boardA))
#expect(shoeGazeB.isBoardAudible(boardB))
}
@Test func removeBoardLeavesOtherBoards() throws {
let renderDuration: Double = 0.05
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(