WebAudioSound will now set hasEnded = false as part of stopAndRemoveBufferSource, after the source has been stopped and disconnected. This should prevent it from being left in a true state if the source onended callback fired late, after the sound had been re-played. Fix #6657

This commit is contained in:
Richard Davey 2024-02-20 17:50:44 +00:00
parent 8c9f7c7b37
commit 2dfd421495

View file

@ -444,13 +444,17 @@ var WebAudioSound = new Class({
{
if (this.source)
{
this.source.stop();
this.source.disconnect();
var tempSource = this.source;
this.source = null;
tempSource.stop();
tempSource.disconnect();
}
this.playTime = 0;
this.startTime = 0;
this.hasEnded = false;
this.stopAndRemoveLoopBufferSource();
},
@ -622,8 +626,6 @@ var WebAudioSound = new Class({
if (this.hasEnded)
{
this.hasEnded = false;
BaseSound.prototype.stop.call(this);
this.stopAndRemoveBufferSource();