Add segmented pedal switch control; Mu-Tron sweep + mode switches

Introduces a discrete multi-position switch control alongside the rotary
knobs, and uses it to expose the Mu-Tron's sweep direction and filter mode.

- PedalSwitch: UI-agnostic descriptor (label, node, ordered options of
  caption + value), parallel to PedalKnob. Two options make a two-state
  switch, three a three-state switch.
- PedalSwitchView: segmented SwiftUI control bound to a UIParamNode. Lit
  segment is the option nearest the node's value; tapping writes that
  option's value. Serves both two- and three-state switches.
- Pedal gains an effectSwitches hook; PedalView renders a switch row
  between the knob grid and the footswitch.
- MuTronPedal: sweep direction is now a two-state switch (Down/Up) and
  filter mode a three-state switch (LP/BP/HP). The effect builds six
  MuTronIII instances (three modes x two directions) selected by a nested
  Select so every filter state stays warmed for click-free switching.
- Presets: PedalState gains a backward-compatible switchValues array
  (decodes to empty for older presets); captureState/applyState persist
  and restore switch positions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 15:40:26 -07:00
parent c28e7cac90
commit cb28ea8c7d
8 changed files with 403 additions and 29 deletions
@@ -247,6 +247,7 @@ public struct PedalView: View {
VStack(spacing: PedalView.sectionSpacing) {
namePlate
knobGrid
switchRow
Spacer(minLength: 0)
bottomControls
}
@@ -312,6 +313,20 @@ public struct PedalView: View {
}
}
/// Row of segmented switches drawn from `pedal.effectSwitches`, one per row, beneath
/// the knob grid. Renders nothing when the pedal publishes no switches.
@ViewBuilder
private var switchRow: some View {
let switches: [PedalSwitch] = pedal.effectSwitches
if !switches.isEmpty {
VStack(spacing: PedalView.knobSpacing) {
ForEach(Array(switches.enumerated()), id: \.offset) { pair in
PedalSwitchView(pair.element)
}
}
}
}
/// Bottom control row: the `Level` knob and the bypass switch side-by-side, centred
/// with equal padding below.
private var bottomControls: some View {