Add .stereo mode to the macOS demo app
New DemoMode.stereo: Overdrive → splitStereo(Delay | Ping-Pong) → collectStereo, finalized to stereo output. DemoRootView renders the pre-split board + StereoWidthBadge above StereoSplitSectionView, so the four StereoRoute modes are selectable live. No new files / no .pbxproj change — the demo already links LyrebirdShoeGazeUI. BUILD SUCCEEDED. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"originHash" : "cfdd71f4b32d744c862bbe26a8265d75aa9e906275b0fb1b63575b7d68be1b6a",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "linenoise-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/andybest/linenoise-swift",
|
||||
"state" : {
|
||||
"revision" : "afc897c02b030af7333105c4fedcd843a8339238",
|
||||
"version" : "0.0.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "lyrebird",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
|
||||
"state" : {
|
||||
"revision" : "032b7c39d351eba4029e8399e1ab1ee201e8bb5c",
|
||||
"version" : "1.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "nimble",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Quick/Nimble.git",
|
||||
"state" : {
|
||||
"revision" : "e9d769113660769a4d9dd3afb855562c0b7ae7b0",
|
||||
"version" : "7.3.4"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import LyrebirdShoeGazeUI
|
||||
/// - `.editor` → `BoardEditorView` — board + FlowLayout pedal area + version snapshots.
|
||||
/// - `.parallel` → `ParallelSectionView` — splitter, two branch rows, merger (via board).
|
||||
/// - `.router` → `ChainRouterView` — dual-board chain router with splitter + master.
|
||||
/// - `.stereo` → `StereoSplitSectionView` — stereo split with the four route modes.
|
||||
struct DemoRootView: View {
|
||||
|
||||
// MARK: - Layout constants
|
||||
@@ -207,6 +208,9 @@ struct DemoRootView: View {
|
||||
|
||||
case .router:
|
||||
routerContent
|
||||
|
||||
case .stereo:
|
||||
stereoContent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +251,27 @@ struct DemoRootView: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// `.stereo` content: the full board view (shows the pre-split pedal) stacked above a
|
||||
/// width badge and `StereoSplitSectionView` (route picker + L/R branch rows).
|
||||
@ViewBuilder
|
||||
private var stereoContent: some View {
|
||||
if let section: StereoSplitSection = controller.stereoSection,
|
||||
let board: PedalBoard = controller.shoeGaze.boards.first {
|
||||
ScrollView(.vertical, showsIndicators: true) {
|
||||
VStack(alignment: .leading, spacing: 20) {
|
||||
HStack(spacing: 10) {
|
||||
PedalBoardView(board: board)
|
||||
StereoWidthBadge(width: board.width)
|
||||
}
|
||||
StereoSplitSectionView(section: section)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Text("Stereo split unavailable.")
|
||||
.foregroundStyle(Color.white.opacity(0.55))
|
||||
}
|
||||
}
|
||||
|
||||
/// `.router` content: `ChainRouterView` bound to the live `ChainRouter`.
|
||||
@ViewBuilder
|
||||
private var routerContent: some View {
|
||||
|
||||
@@ -32,6 +32,10 @@ enum DemoMode: String, CaseIterable, Identifiable {
|
||||
/// B: Fuzz + Reverb) and recombines them through a shared master stage.
|
||||
case router = "Router"
|
||||
|
||||
/// A board with a ``StereoSplitSection`` (Overdrive → splitStereo(Delay | PingPong) →
|
||||
/// collectStereo) showcasing the four ``StereoRoute`` modes and stereo output.
|
||||
case stereo = "Stereo"
|
||||
|
||||
var id: String { rawValue }
|
||||
|
||||
/// Short human-readable title used in the mode picker.
|
||||
@@ -41,6 +45,7 @@ enum DemoMode: String, CaseIterable, Identifiable {
|
||||
case .editor: return "Editor"
|
||||
case .parallel: return "Parallel"
|
||||
case .router: return "Router"
|
||||
case .stereo: return "Stereo"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,6 +84,9 @@ final class ShoeGazeDemoController {
|
||||
/// Non-nil only in `.parallel` mode, after ``buildParallel()`` succeeds.
|
||||
private(set) var parallelSection: ParallelSection?
|
||||
|
||||
/// Non-nil only in `.stereo` mode, after ``buildStereo()`` succeeds.
|
||||
private(set) var stereoSection: StereoSplitSection?
|
||||
|
||||
/// Stores named board snapshots for the `.editor` showcase.
|
||||
let versionStore: BoardVersionStore = BoardVersionStore()
|
||||
|
||||
@@ -165,6 +173,7 @@ final class ShoeGazeDemoController {
|
||||
shoeGaze.teardown()
|
||||
router = nil
|
||||
parallelSection = nil
|
||||
stereoSection = nil
|
||||
|
||||
shoeGaze = ShoeGaze(engine: engine, inputSource: inputSource)
|
||||
|
||||
@@ -173,6 +182,7 @@ final class ShoeGazeDemoController {
|
||||
case .editor: buildEditor()
|
||||
case .parallel: buildParallel()
|
||||
case .router: buildRouter()
|
||||
case .stereo: buildStereo()
|
||||
}
|
||||
|
||||
if wasRunning { start() }
|
||||
@@ -279,5 +289,29 @@ final class ShoeGazeDemoController {
|
||||
print("[ShoeGazeDemoController] buildRouter failed: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/// `.stereo` — Overdrive → splitStereo(left: Delay | right: Ping-Pong) → collectStereo.
|
||||
///
|
||||
/// Demonstrates the stereo split mechanism: a mono signal fanned into two independently
|
||||
/// authored chains that become the left and right output channels, with the four
|
||||
/// ``StereoRoute`` modes (stereo / left / right / bypass) selectable live. Stores the
|
||||
/// `StereoSplitSection` so `DemoRootView` can display `StereoSplitSectionView`.
|
||||
private func buildStereo() {
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
board.label = "Stereo Board"
|
||||
try board.add(OverdrivePedal())
|
||||
|
||||
let section: StereoSplitSection = try board.splitStereo()
|
||||
try section.left.add(DelayPedal())
|
||||
try section.right.add(PingPongDelayPedal())
|
||||
try board.collectStereo(section)
|
||||
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
stereoSection = section
|
||||
} catch {
|
||||
print("[ShoeGazeDemoController] buildStereo failed: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user