Skip to content

Commit 7bde818

Browse files
Override applyConfig method and moved rateUpdates resetting logic there
1 parent dc4bb51 commit 7bde818

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ var WebAudioSound = new Class({
8484
var seek = this.currentConfig.seek;
8585
var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek;
8686
var duration = this.duration - seek;
87-
this.rateUpdates.push({
88-
time: 0,
89-
rate: 1
90-
});
9187
this.createAndStartBufferSource(offset, duration);
9288
this.startTime = this.manager.context.currentTime - seek;
9389
this.pausedTime = 0;
@@ -134,7 +130,6 @@ var WebAudioSound = new Class({
134130
this.source = this.manager.context.createBufferSource();
135131
this.source.buffer = this.audioBuffer;
136132
this.source.connect(this.muteNode);
137-
this.rateUpdates.length = 0;
138133
this.applyConfig();
139134
this.source.onended = function (ev) {
140135
if (ev.target === this.source) {
@@ -156,6 +151,14 @@ var WebAudioSound = new Class({
156151
this.source = null;
157152
}
158153
},
154+
applyConfig: function () {
155+
this.rateUpdates.length = 0;
156+
this.rateUpdates.push({
157+
time: 0,
158+
rate: 1
159+
});
160+
BaseSound.prototype.applyConfig.call(this);
161+
},
159162
/**
160163
* Update method called on every game step.
161164
*

0 commit comments

Comments
 (0)