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
+9
View File
@@ -118,6 +118,15 @@ open class Pedal: SynthesizerBase {
[]
}
/// Effect-specific discrete switches for this pedal, rendered as a row of segmented
/// controls beneath the knob grid.
///
/// Override in subclasses to publish each discrete `@UIParam` parameter as a two- or
/// three-state ``PedalSwitch`` (sweep direction, filter mode, …). Defaults to empty.
open var effectSwitches: [PedalSwitch] {
[]
}
/// All knobs a generic UI should render for this pedal: effect-specific knobs
/// first, then the common `mix` and `level` knobs. The `bypass` parameter is
/// surfaced separately as a header toggle, not as a knob.