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:
@@ -10,7 +10,12 @@
|
||||
/// `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.
|
||||
enum BoardSegment {
|
||||
///
|
||||
/// 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)
|
||||
|
||||
Reference in New Issue
Block a user