Looper: also reset on rig teardown
Add a Pedal.rigWillTeardown() hook fired for every pedal at the top of ShoeGaze.teardown() (rig load / clear / input-source change), while the pedal is still live. LooperPedal resets and posts a notice, sharing the path with engineDidStop() — so a looper stops its background routines cleanly and logs before its instance is discarded across a rig change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -403,6 +403,19 @@ struct LooperPedalTests {
|
||||
} }
|
||||
}
|
||||
|
||||
@Test func rigTeardownResetsLooper() 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()
|
||||
pedal.pressLoop() // playing
|
||||
pedal.rigWillTeardown()
|
||||
#expect(pedal.transportState == .clear, "a rig teardown returns the looper to clear")
|
||||
#expect(pedal.stateDescription == "Looper reset — rig changed.")
|
||||
} }
|
||||
}
|
||||
|
||||
@Test func stopResumeAndCueStop() throws {
|
||||
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
|
||||
try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0)
|
||||
|
||||
Reference in New Issue
Block a user