diff --git a/Sources/LyrebirdShoeGaze/Pedals/LooperPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/LooperPedal.swift index 69cb407..7fffc7f 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/LooperPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/LooperPedal.swift @@ -532,9 +532,13 @@ public final class LooperPedal: Pedal { masterLength = 0 masterBeats = 0.0 loopOn = 1.0 + reverse = 0.0 // clean slate: forward playback playTrigger = 0.0 stoppedIndicator = 0.0 cueStopArmed = 0.0 + // Drop any lingering transient notice so it can't mask the fresh state indicator. + noticeText = nil + noticeExpiry = nil updateOverdubGates() phase = .clear } diff --git a/Tests/LyrebirdShoeGazeTests/LooperPedalTests.swift b/Tests/LyrebirdShoeGazeTests/LooperPedalTests.swift index 23bedbf..e195f5f 100644 --- a/Tests/LyrebirdShoeGazeTests/LooperPedalTests.swift +++ b/Tests/LyrebirdShoeGazeTests/LooperPedalTests.swift @@ -437,6 +437,33 @@ struct LooperPedalTests { } } } + @Test func recordsAgainAfterReset() throws { + let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) = + try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0) + withExtendedLifetime(engine) { withExtendedLifetime(clock) { + pedal.clock = nil + pedal.pressLoop() // record A + pedal.pressLoop() // playing + overdub A + pedal.toggleReverse() // leave reverse engaged before reset + #expect(pedal.reverse == 1.0) + + pedal.resetLoop() + #expect(pedal.transportState == .clear) + #expect(pedal.overdubbingTrackIndex == nil) + #expect(pedal.reverse == 0.0, "reset returns to forward playback") + + // Second take must behave exactly like the first — including auto-overdub on A, + // which was silently blocked when reset didn't clear a left-on reverse. + pedal.pressLoop() + #expect(pedal.transportState == .recordingMaster, "record after reset should re-enter recording") + #expect(pedal.loopButtonCaption == "Set End") + pedal.pressLoop() + #expect(pedal.transportState == .playing) + #expect(pedal.overdubbingTrackIndex == 0, "auto-overdub on A must engage after a reset") + #expect(pedal.trackHasContent(0)) + } } + } + @Test func stopResumeAndCueStop() throws { let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) = try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0)