Files
ShoeGaze/Sources/LyrebirdShoeGaze/Routing/PedalChannelKind.swift
T
josh f89229282f Add mono→stereo routing to PedalBoard
Introduce chain width propagation (mono=1 / stereo=2, capped at 2),
represented as a pair of mono buses to reuse existing infrastructure.

- Pedal: width-parameterized build() with channelKind (mono / widener /
  stereoNative); effect() runs per channel for auto-stereoize, shared knobs.
- PedalBoard: width tracking, add() dispatch, mergeToMono(), splitStereo()/
  collectStereo() with four route modes (stereo / leftOnly / rightOnly /
  bypass), centered solo, click-free lagged gains.
- BoardOutputMaster: width-aware (Pan2 mono, direct L/R stereo).
- New routing nodes: StereoSplitter, StereoRouteCollector, StereoSplitSection.
- Reference pedals: OctaveUpSplitterPedal (widener), PingPongDelayPedal
  (stereo-native).
- 12 stereo-routing tests; full suite 108/108.

Design: docs/stereo-routing-design.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 16:48:25 -07:00

34 lines
1.4 KiB
Swift

// PedalChannelKind.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
/// Declares how a ``Pedal`` relates its input channels to its output channels.
///
/// The board uses this to decide how many buses to hand a pedal and how its
/// `build()` should be dispatched:
///
/// - `mono`: one channel in, one channel out. A `mono` pedal is *stereoizable* —
/// when the board places it in a stereo (width-2) region it runs the pedal's
/// `effect(_:)` once per channel, giving two independent DSP graphs that share
/// the pedal's knobs. This is the default and covers every ordinary pedal.
/// - `widener`: mono in, two distinct wet outs (1 → 2). Widens the chain from
/// mono to stereo. Only valid in a width-1 region; the board rejects a widener
/// in an already-stereo region (width is capped at 2).
/// - `stereoNative`: two channels in, two channels out, with cross-channel
/// coupling that cannot be expressed as two independent monos (e.g. a
/// ping-pong delay). One instance reads both input buses and writes both
/// output buses.
public enum PedalChannelKind {
/// One in, one out. Stereoized per-channel by the board when in a stereo region.
case mono
/// Mono in, two distinct wet outs (1 → 2). Widens the chain to stereo.
case widener
/// Two in, two out with cross-channel coupling (e.g. ping-pong delay).
case stereoNative
}