Files
josh 10a6e122bf feat(midi): MIDI-mappable primary transport footswitch (Capture / Freeze)
Expose a pedal's primary transport footswitch — TunedVerb's Capture, FreezVerb's
Freeze — as a MIDI-mappable action, so a footswitch (Program Change) can trigger
it. Previously only per-pedal Bypass and the looper's transport were mappable.

- New `MIDITransportPedal` protocol (@MainActor): `midiTransportName` + a
  `toggleMIDITransport()` that presses the pedal's primary footswitch. TunedVerb
  (Capture) and FreezVerb (Freeze) conform.
- `MIDIMap.PedalActionKind.pedalPrimaryTransport`, dispatched by MIDIController to
  `toggleMIDITransport()`. Learn / persist / resolve-by-id ride the existing
  pedalAction path (same as the looper actions).
- The mapping sheet lists the action for any `MIDITransportPedal`
  ("Board 2 · TunedVerb · Capture"); the per-pedal control-mapping strip shows a
  badge for it. A future press-to-trigger pedal just conforms and appears.

Tests: conformance + a Program-Change round-trip toggling Capture on/off. Full
suite 846 green; both demos build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-25 20:11:07 -08:00

26 lines
1.2 KiB
Swift

// MIDITransportPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
/// A pedal with a primary **transport footswitch** — a momentary, latching action beyond generic
/// bypass (e.g. TunedVerb's *Capture*, FreezVerb's *Freeze*) — that can be driven by a MIDI
/// footswitch.
///
/// Conforming makes the action appear in the MIDI mapping sheet automatically and lets a mapped
/// Program Change fire it: the sheet lists `midiTransportName`, and `MIDIController` calls
/// ``toggleMIDITransport()`` for a `PedalActionKind/pedalPrimaryTransport` binding. A pedal with a
/// richer transport surface (the looper) is handled by its own dedicated action kinds instead.
@MainActor
public protocol MIDITransportPedal: AnyObject {
/// Short display name of the primary transport footswitch (e.g. `"Capture"`, `"Freeze"`), shown
/// in the MIDI mapping sheet after the pedal name.
var midiTransportName: String { get }
/// Toggles the primary transport footswitch — called when a mapped MIDI footswitch fires. Same
/// effect as pressing the pedal's on-screen footswitch.
func toggleMIDITransport()
}