Looper: fix multitrack RT-safety findings from review

Phase-lock: reset the overdub recorder write heads (requestReset) and the
player play-heads (playTrigger rising edge) synchronously in startPlayback so
both re-anchor on the same audio block, instead of deferring the trigger an
extra run-loop turn; playTrigger is zeroed on every stop for a clean 0→1 edge.
This also makes overdub actually record under NRT.

Reverse vs overdub: overdub records forward-in-time and can't follow a reversed
play-head. Block engaging overdub while reversed, and make Reverse a
toggleReverse() action that ends any active overdub when engaging reverse (the
footswitch keeps its LED via indicator: $reverse).

resetLoop: gate isPlaying off before clear() so the buffer-clear overlaps at
most one in-flight RT block; corrected the rationale comment.

Docs: fix stale $overdubOn / .empty / .recording references.

Tests: overdubbingTrackAAddsEnergyToTheLoop (NRT overdub records),
overdubBlockedWhileReversed, engagingReverseWhileOverdubbingEndsOverdub.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 15:07:41 -07:00
parent 3007b76798
commit 83b8fff74b
4 changed files with 115 additions and 25 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ public struct PedalButton {
/// - Parameters:
/// - label: Short label shown on the button.
/// - node: The `UIParamNode` projected value of an `@UIParam` property
/// (`pedal.$overdubOn`, `pedal.$loopOn`, …).
/// (`pedal.$loopOn`, `pedal.$reverse`, …).
/// - dynamicLabel: Optional live caption describing the next press (see ``dynamicLabel``).
public init(label: String, node: UIParamNode, dynamicLabel: (() -> String)? = nil) {
self.label = label