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>
This commit is contained in:
2026-11-25 20:11:07 -08:00
parent 9dfadb129d
commit 10a6e122bf
8 changed files with 95 additions and 0 deletions
@@ -417,6 +417,8 @@ public final class MIDIController {
(pedal as? LooperPedal)?.cycleSyncMode()
case .looperTrack(let index):
(pedal as? LooperPedal)?.tapTrack(index)
case .pedalPrimaryTransport:
(pedal as? MIDITransportPedal)?.toggleMIDITransport()
}
}
@@ -114,6 +114,10 @@ public struct MIDIMap: Codable, Equatable, Sendable {
/// Looper: taps track `index` (0 = A) — selects it, or mutes it if already selected and
/// recorded (`LooperPedal.tapTrack(_:)`), matching the A/B/C/D dots.
case looperTrack(index: Int)
/// Toggles a pedal's primary transport footswitch — any ``MIDITransportPedal`` (e.g.
/// TunedVerb's Capture, FreezVerb's Freeze). Dispatched to `toggleMIDITransport()`.
case pedalPrimaryTransport
}
// MARK: - Switch binding
@@ -0,0 +1,25 @@
// 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()
}