// BoardSegment.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT /// One ordered element of a ``PedalBoard``'s signal chain, used to capture full topology /// (including parallel and stereo split regions) in signal-flow order. /// /// `PedalBoard` records these as pedals and split regions are added, so a board can be /// serialized and rebuilt faithfully rather than as a flat pedal list. Branch pedals live /// inside their section objects, not as separate segments. /// /// Public so a UI can walk a board's live structure in signal-flow order (each element carries /// the live `Pedal` / section object). The index of a segment within `PedalBoard.orderedSegments` /// matches its index in `captureState().segments`, which is the region index used by the /// lane-addressed edit API (see ``PedalLane``). public enum BoardSegment { /// A single linear pedal in the main chain. case pedal(Pedal) /// A parallel section (`split()` → two branches → `merge()`). case parallel(ParallelSection) /// A stereo split region (`splitStereo()` → two branches → `collectStereo()`). case stereoSplit(StereoSplitSection) /// A stereo unzip region (`unzipStereo()` → two branches → `collectStereo()`). Reuses the /// `StereoSplitSection` payload; the distinct case lets capture/rebuild pick the unzip splitter. case stereoUnzip(StereoSplitSection) /// A `mergeToMono()` collapse — narrows a stereo tail back to mono. Carries no state; /// recorded so the width transition replays on rebuild. case mergeToMono }