Looper: MIDI-mappable A/B/C/D track taps

Add looperTrack(index:) PedalActionKind dispatched to LooperPedal.tapTrack, and
Track A–D rows in the MIDI mapping sheet (one per track, up to trackCount). A
mapped switch/Program Change taps the dot — selecting the track, or muting it
when it's already selected and recorded — matching the timeline dots. Covered
by pedalActionTapsLooperTrack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 18:54:47 -07:00
parent 296ca1b24e
commit b6f1d78066
4 changed files with 38 additions and 1 deletions
@@ -306,4 +306,31 @@ struct MIDIControllerPCTests {
#expect(looper.syncToBeat == 0.0, "mapped Program Change should oscillate Sync through its options")
}
}
@Test func pedalActionTapsLooperTrack() throws {
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.05, numAudioBuses: 256)
let sg: ShoeGaze = ShoeGaze(engine: engine)
let board: PedalBoard = try sg.addBoard()
let looper: LooperPedal = LooperPedal()
try board.add(looper)
try sg.finalizeBoard(board)
let controller: MIDIController = MIDIController(engine: engine, shoeGaze: sg)
defer { try? FileManager.default.removeItem(at: url) }
withExtendedLifetime(sg) {
// Get a recorded, selected track A (immediate transport).
looper.clock = nil
looper.pressLoop()
looper.pressLoop()
#expect(looper.trackHasContent(0))
#expect(!looper.isTrackMuted(0))
controller.armSwitchLearn(.pedalAction(pedalID: looper.id, kind: .looperTrack(index: 0)))
controller.ingestForTesting(.programChange(channel: 0, program: 22)) // learn only
#expect(!looper.isTrackMuted(0))
controller.ingestForTesting(.programChange(channel: 0, program: 22)) // fire → tapTrack(0) → mute A
#expect(looper.isTrackMuted(0), "mapped Program Change should tap (mute) the selected recorded track")
}
}
}