Repository navigation
Fix: Stop a paused instance for good - #294
Merged
Merged
Conversation
- WebAudio stop() did nothing while paused, since pausing nulls the source, so the instance never emitted stop, stayed in the sound's instances and played again on the next resume (#258) - stop() now also acts when the instance is really paused, so Sound removes and pools it, on every pause path (instance, sound, pauseAll, window blur) and through Sound.stop and stopAll - Lifecycle tests on both backends, checking the stop event, the instance count and silence on the analyser after resume
This was referenced Oct 30, 2026
zbdd
added a commit
that referenced
this pull request
Nov 2, 2026
- WebAudio stop() did nothing while paused, since pausing nulls the source, so the instance never emitted stop, stayed in the sound's instances and played again on the next resume (#258) - stop() now also acts when the instance is really paused, so Sound removes and pools it, on every pause path (instance, sound, pauseAll, window blur) and through Sound.stop and stopAll - Lifecycle tests on both backends, checking the stop event, the instance count and silence on the analyser after resume (cherry picked from commit 154e125)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On WebAudio,
stop()on a paused instance did nothing. Pausing drops the instance's source andstop()only acted when there was one, so the instance never emittedstop, stayed in the sound'sinstancesand started playing again on the next resume. Thats every way of pausing (instancepaused,mySound.pause(),pauseAll(), window blur), plusmySound.stop()andstopAll()while paused. HTML already stops paused instances.Replaces #270, which gets the first resume right but leaves the instance live, so it comes back on the next pause and resume.
Fixes #258
Fixes #211
Changes
pausedon an instance after stopping it now throws on WebAudio, same as on HTML and as a stopped playing instance already didstopevent, and with those checks removed, on the sound being audible again after resume