Add board edit API: lane-addressed pedal/region editing
Core support for interactively building and editing a board, all via the existing capture-BoardState -> mutate -> rebuildBoard path (no RT-graph surgery): - PedalLane addresses the main chain or a stereo/parallel branch. - appendPedal/removePedal/movePedal gain a `lane:` parameter (default .main, so existing call sites are unchanged). - appendStereoSplit/appendParallelSplit/appendMergeToMono/removeSegment insert and remove branch regions; split/merge guarded by tail width. - setInputSource preserves the rig across an input-source change. - rebuildAllBoards / loadRig(from:Data) / rigData added; loadRig is now atomic (teardown-on-failure) so a failed load leaves an empty rig. - Expose PedalBoard.orderedSegments and BoardSegment publicly so a UI can walk live board structure; index aligns with captureState().segments. - InputSource: Equatable. New errors: unknownPedalType, pedalIndexOutOfRange, cannotSplitStereoChain, cannotMergeMonoChain, notABranchRegion. Tests cover append/remove/move on main and branch lanes, region add/remove, width guards, move-to-end before trailing regions, input switch, and knob/bypass/branch value persistence through save/load. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -122,8 +122,10 @@ public final class PedalBoard {
|
||||
private var branchChains: [BranchChain] = []
|
||||
|
||||
/// Ordered signal-chain segments (pedals + split regions) in signal-flow order. Used to
|
||||
/// capture full board topology for serialization. Maintained by `add`/`split`/`splitStereo`.
|
||||
private(set) var orderedSegments: [BoardSegment] = []
|
||||
/// capture full board topology for serialization and to drive signal-flow UIs. Maintained by
|
||||
/// `add`/`split`/`splitStereo`. A segment's index here matches its index in
|
||||
/// `captureState().segments` — the region index used by the lane-addressed edit API.
|
||||
public private(set) var orderedSegments: [BoardSegment] = []
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
|
||||
Reference in New Issue
Block a user