1a09cf9cf8
A stereo-output pedal (Ping-Pong, Octave Splitter) now shows a "Stereo flow / Split L/R" toggle on its card: - Stereo flow (default): unchanged broadcast behavior — following pedals process both channels as one stereo flow. - Split L/R: inserts a Stereo Unzip region right after the pedal, routing the L channel into one lane and R into the other for independent processing, then recombining to stereo with the same route/solo/bypass control as the stereo split. Engine/core: - StereoUnzipSplitter: 2-in -> 3-out node (L->lane L, R->lane R, and a centered 0.5*L+0.5*R dry tap for the bypass route). - PedalBoard.unzipStereo() mirrors splitStereo() but reads both tails and requires width 2; reuses collectStereo / StereoSplitSection / StereoRouteCollector. New stereoUnzipSections (cleared on teardown). - BoardSegment/.stereoUnzip + StereoUnzipState round-trip via preset capture/rebuild/applyState. - ShoeGaze.insertStereoUnzip(afterSegment:)/isStereoUnzip(afterSegment:) drive the toggle; invalid insert (mono tail) throws cannotUnzipMonoChain and the atomic rebuild keeps the board intact. - StereoSplitSection.splitter relaxed to `any Synthesizer` (stored only) so it can hold either splitter type. UI: per-pedal toggle + STEREO UNZIP region rendering in BoardFlowView. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
2.0 KiB
Swift
51 lines
2.0 KiB
Swift
// PedalBoard+Preset.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
extension PedalBoard {
|
|
|
|
/// Captures the current state of this board's label and full signal-chain topology as a
|
|
/// `BoardState`.
|
|
///
|
|
/// Walks the board's ordered segments, snapshotting each linear pedal and each split
|
|
/// region (parallel and stereo) in signal-flow order — including branch pedal chains and
|
|
/// the section's routing mode. The engine graph is not modified; this is read-only.
|
|
///
|
|
/// - Returns: A `BoardState` reflecting the board's current topology and parameters.
|
|
public func captureState() -> BoardState {
|
|
let segmentStates: [BoardSegmentState] = orderedSegments.map { segment in
|
|
switch segment {
|
|
case .pedal(let pedal):
|
|
return BoardSegmentState.pedal(pedal.captureState())
|
|
|
|
case .parallel(let section):
|
|
return BoardSegmentState.parallel(ParallelSectionState(
|
|
branchA: section.branchA.pedals.map { $0.captureState() },
|
|
branchB: section.branchB.pedals.map { $0.captureState() },
|
|
mode: section.splitter.mode
|
|
))
|
|
|
|
case .stereoSplit(let section):
|
|
return BoardSegmentState.stereoSplit(StereoSplitState(
|
|
left: section.left.pedals.map { $0.captureState() },
|
|
right: section.right.pedals.map { $0.captureState() },
|
|
route: section.route
|
|
))
|
|
|
|
case .stereoUnzip(let section):
|
|
return BoardSegmentState.stereoUnzip(StereoUnzipState(
|
|
left: section.left.pedals.map { $0.captureState() },
|
|
right: section.right.pedals.map { $0.captureState() },
|
|
route: section.route
|
|
))
|
|
|
|
case .mergeToMono:
|
|
return BoardSegmentState.mergeToMono
|
|
}
|
|
}
|
|
return BoardState(label: label, segments: segmentStates)
|
|
}
|
|
}
|