Add looper pedal: beat-quantized transport, undo, reverse, timeline

Extend the looper into a double-width tempo-aware pedal:

- Beat-quantized transport: record start and loop close both snap to the
  next beat via a LyrebirdRoutine waiting on the shared clock; loop length
  is an exact whole-beat span. Falls back to immediate/unquantized when no
  clock is present.
- Loop-length read-outs (frames/seconds/beats), transport state, and a
  sample-clock-derived play-head position for the UI timeline.
- Overdub undo (pre-dub snapshot + restore), reverse playback (live rate
  flip), and feedback-decay overdub (overdub preLevel via a Feedback knob).
- Inject the shared LyrebirdClock + SynthesisEngine into Pedal via
  PedalBoard/ChainRouter so tempo-aware pedals can reach them.
- New double-width LooperTimelineView (state badge, length read-out,
  sweeping play-head) wired into PedalView via Pedal.widthUnits.

Concurrency hardening from RT-safety review: a transportGeneration counter
drops superseded deferred beat/undo callbacks that LyrebirdRoutine.stop()
cannot recall once enqueued; the undo restore is deferred past the RT
overdub gate-close; transport routines use non-blocking stop().

Note: this commit also snapshots pre-existing uncommitted work-in-progress
already in the tree (MIDI control refactor, Tuner, Tempo, preset changes),
which is interleaved with the looper changes through shared files and could
not be split into a separately-building commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 09:22:20 -07:00
parent 097253b410
commit 947dfe427a
47 changed files with 3263 additions and 176 deletions
@@ -102,23 +102,22 @@ public struct MIDIMappingSheet: View {
SwitchRowModel(id: "sw-mute", action: .rigMute, label: "Rig Mute"),
SwitchRowModel(id: "sw-all", action: .allBoards, label: "All Boards On"),
]
for boardPair: (offset: Int, element: PedalBoard) in shoeGaze.boards.enumerated() {
let boardIndex: Int = boardPair.offset
let board: PedalBoard = boardPair.element
rows.append(SwitchRowModel(id: "sw-solo-\(boardIndex)",
action: .boardSolo(boardIndex: boardIndex),
for board: PedalBoard in shoeGaze.boards {
let boardID: UUID = board.id
rows.append(SwitchRowModel(id: "sw-solo-\(boardID)",
action: .boardSolo(boardID: boardID),
label: "\(board.label) · Solo"))
rows.append(SwitchRowModel(id: "sw-aud-\(boardIndex)",
action: .boardAudible(boardIndex: boardIndex),
rows.append(SwitchRowModel(id: "sw-aud-\(boardID)",
action: .boardAudible(boardID: boardID),
label: "\(board.label) · Audible"))
rows.append(SwitchRowModel(id: "sw-byp-\(boardIndex)",
action: .boardBypass(boardIndex: boardIndex),
rows.append(SwitchRowModel(id: "sw-byp-\(boardID)",
action: .boardBypass(boardID: boardID),
label: "\(board.label) · Bypass"))
for pedalPair: (offset: Int, element: Pedal) in board.pedals.enumerated() {
for pedal: Pedal in board.pedals {
rows.append(SwitchRowModel(
id: "sw-pb-\(boardIndex)-\(pedalPair.offset)",
action: .pedalBypass(boardIndex: boardIndex, pedalIndex: pedalPair.offset),
label: "\(board.label) · \(pedalPair.element.displayName) · Bypass"))
id: "sw-pb-\(pedal.id)",
action: .pedalBypass(pedalID: pedal.id),
label: "\(board.label) · \(pedal.displayName) · Bypass"))
}
}
return rows
@@ -128,23 +127,18 @@ public struct MIDIMappingSheet: View {
var rows: [CCRowModel] = [
CCRowModel(id: "cc-rigvol", target: .rigVolume, label: "Rig · Volume"),
]
for boardPair: (offset: Int, element: PedalBoard) in shoeGaze.boards.enumerated() {
let boardIndex: Int = boardPair.offset
let board: PedalBoard = boardPair.element
for board: PedalBoard in shoeGaze.boards {
// Board master level (the board fader).
rows.append(CCRowModel(
id: "cc-blvl-\(boardIndex)",
target: .boardLevel(boardIndex: boardIndex, boardLabelHint: nil),
id: "cc-blvl-\(board.id)",
target: .boardLevel(boardID: board.id, boardLabelHint: nil),
label: "\(board.label) · Level"))
for pedalPair: (offset: Int, element: Pedal) in board.pedals.enumerated() {
let pedalIndex: Int = pedalPair.offset
let pedal: Pedal = pedalPair.element
for pedal: Pedal in board.pedals {
for controlPair: (offset: Int, element: PedalControl) in pedal.ccMappableControls.enumerated() {
rows.append(CCRowModel(
id: "cc-\(boardIndex)-\(pedalIndex)-\(controlPair.offset)",
id: "cc-\(pedal.id)-\(controlPair.offset)",
target: .pedalControl(
boardIndex: boardIndex,
pedalIndex: pedalIndex,
pedalID: pedal.id,
controlIndex: controlPair.offset,
pedalNameHint: nil,
controlLabelHint: nil),