Looper: stomp-style Reset button; reset on engine stop

Reset now renders as an LED + footswitch like the other transport buttons —
its LED lights whenever there's something to reset (any non-clear state),
driven off a phase didSet.

Add a Pedal.engineDidStop() hook, invoked for every pedal by a new
ShoeGaze.stopEngine() that the user-facing Stop control now calls (transient
stop-around-rebuild sequences still call engine.stop() directly, so pedals
keep state across a restart). LooperPedal overrides it to return to the clear
state, post to LyrebirdMessageCenter, and briefly show "Looper reset — engine
stopped." on its own card via the state indicator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 15:20:33 -07:00
parent 83b8fff74b
commit fee7892101
5 changed files with 93 additions and 4 deletions
@@ -381,6 +381,28 @@ struct LooperPedalTests {
} }
}
@Test func engineStopResetsLooperAndPostsNotice() 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
#expect(pedal.transportState == .playing)
pedal.engineDidStop()
#expect(pedal.transportState == .clear, "engine stop returns the looper to clear")
#expect(pedal.loopFrameCount == 0)
#expect(pedal.stateDescription == "Looper reset — engine stopped.",
"a transient notice is shown after the engine-stop reset")
// A no-op when already clear (no spurious notice).
let clearPedal: LooperPedal = LooperPedal()
clearPedal.engineDidStop()
#expect(clearPedal.transportState == .clear)
} }
}
@Test func stopResumeAndCueStop() throws {
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0)