Looper: MIDI-mappable Sync, cycling through the switch options
Add a looperSyncToggle PedalActionKind (dispatched to LooperPedal.cycleSyncMode) and a Sync row in the MIDI mapping sheet. A mapped switch/Program Change oscillates the control through its positions on each press, via a reusable PedalSwitch.nextValue(after:) that advances to the next option and wraps — so this generalises to any multi-position switch, not just the two-state Sync. Tests: cycleSyncModeOscillatesThroughOptions, pedalActionCyclesLooperSync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -437,6 +437,13 @@ public final class LooperPedal: Pedal {
|
||||
|
||||
// MARK: - Stops / reset
|
||||
|
||||
/// Advances the Sync mode through its options (Free ↔ Sync), wrapping — so a MIDI switch can
|
||||
/// oscillate through the positions on each press, matching the segmented control.
|
||||
public func cycleSyncMode() {
|
||||
guard let sync: PedalSwitch = effectSwitches.first(where: { $0.node === $syncToBeat }) else { return }
|
||||
syncToBeat = sync.nextValue(after: syncToBeat)
|
||||
}
|
||||
|
||||
/// Flips playback direction. Engaging reverse ends any active overdub, since overdub records
|
||||
/// forward-in-time and can't follow a backward-reading play-head (see the class doc).
|
||||
public func toggleReverse() {
|
||||
|
||||
Reference in New Issue
Block a user