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:
@@ -261,6 +261,52 @@ public final class ShoeGaze {
|
||||
activeBoardIndex = nil
|
||||
}
|
||||
|
||||
/// Solos `board` exclusively — identical to ``selectBoard(_:crossfadeSeconds:)``.
|
||||
///
|
||||
/// Provided as the "Solo" verb alongside ``setBoard(_:audible:crossfadeSeconds:)`` so
|
||||
/// callers can express *make only this board audible* without conflating it with the
|
||||
/// independent per-board enable used by Blend-style mixing.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - board: The board to solo. No-op if not managed by this instance.
|
||||
/// - crossfadeSeconds: Crossfade duration in seconds (`0` = instant).
|
||||
public func soloBoard(_ board: PedalBoard, crossfadeSeconds: Double) {
|
||||
selectBoard(board, crossfadeSeconds: crossfadeSeconds)
|
||||
}
|
||||
|
||||
/// Sets a single board audible or silent **without** disturbing the others.
|
||||
///
|
||||
/// Unlike ``selectBoard(_:crossfadeSeconds:)`` (which is exclusive), this toggles one
|
||||
/// board's select-gain in place, so arbitrary subsets of boards can play at once — the
|
||||
/// "Blend" mixing model. Because the audible set is no longer a single soloed board,
|
||||
/// ``activeBoardIndex`` is cleared to `nil`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - board: The board to enable or silence. No-op if not managed by this instance.
|
||||
/// - audible: `true` to fade the board in, `false` to fade it out.
|
||||
/// - crossfadeSeconds: Crossfade duration in seconds (`0` = instant).
|
||||
public func setBoard(_ board: PedalBoard, audible: Bool, crossfadeSeconds: Double) {
|
||||
guard boards.contains(where: { $0 === board }) else { return }
|
||||
board.crossfadeTimeNode?.update(crossfadeSeconds)
|
||||
board.selectGainNode?.update(audible ? 1.0 : 0.0)
|
||||
activeBoardIndex = nil
|
||||
}
|
||||
|
||||
/// Whether `board`'s output is currently audible (its select-gain target is on).
|
||||
///
|
||||
/// Reads the live select-gain target, so it reflects the latest
|
||||
/// ``selectBoard(_:crossfadeSeconds:)`` / ``setBoard(_:audible:crossfadeSeconds:)`` /
|
||||
/// ``selectAllBoards(crossfadeSeconds:)`` call (the value the crossfade is ramping
|
||||
/// toward), independent of where the crossfade currently sits.
|
||||
///
|
||||
/// - Parameter board: A board managed by this instance.
|
||||
/// - Returns: `true` when the board's select-gain target is on; `false` when silenced
|
||||
/// or when the board has no output master yet.
|
||||
public func isBoardAudible(_ board: PedalBoard) -> Bool {
|
||||
let selectGainOnThreshold: Double = 0.5
|
||||
return (board.selectGainNode?.value ?? 0.0) > selectGainOnThreshold
|
||||
}
|
||||
|
||||
/// Removes a single board and its associated input source and output master from
|
||||
/// the engine, then releases the board's buses. The other boards are unaffected.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user