Skip to content

Commit 8208389

Browse files
updated source stopping logic for WebAudioSound class
1 parent 6897d65 commit 8208389

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ var WebAudioSound = new Class({
6161
if (!BaseSound.prototype.play.call(this, marker, config)) {
6262
return null;
6363
}
64-
if (this.source) {
65-
this.source.stop();
66-
}
64+
this.stopAndRemoveBufferSource();
6765
// TODO include config offset and marker start
6866
this.createAndStartBufferSource(0, this.currentConfig.duration);
6967
this.startTime = this.manager.context.currentTime;
@@ -118,8 +116,10 @@ var WebAudioSound = new Class({
118116
* @private
119117
*/
120118
stopAndRemoveBufferSource: function () {
121-
this.source.stop();
122-
this.source = null;
119+
if (this.source) {
120+
this.source.stop();
121+
this.source = null;
122+
}
123123
},
124124
update: function () {
125125
},

0 commit comments

Comments
 (0)