From 7bde818fa5bbbbaaafc0ece30fb694b3b64ef2f1 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Tue, 5 Dec 2017 19:35:26 +0100 Subject: [PATCH] Override applyConfig method and moved rateUpdates resetting logic there --- v3/src/sound/webaudio/WebAudioSound.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/v3/src/sound/webaudio/WebAudioSound.js b/v3/src/sound/webaudio/WebAudioSound.js index 378cafa74..945e31cef 100644 --- a/v3/src/sound/webaudio/WebAudioSound.js +++ b/v3/src/sound/webaudio/WebAudioSound.js @@ -84,10 +84,6 @@ var WebAudioSound = new Class({ var seek = this.currentConfig.seek; var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek; var duration = this.duration - seek; - this.rateUpdates.push({ - time: 0, - rate: 1 - }); this.createAndStartBufferSource(offset, duration); this.startTime = this.manager.context.currentTime - seek; this.pausedTime = 0; @@ -134,7 +130,6 @@ var WebAudioSound = new Class({ this.source = this.manager.context.createBufferSource(); this.source.buffer = this.audioBuffer; this.source.connect(this.muteNode); - this.rateUpdates.length = 0; this.applyConfig(); this.source.onended = function (ev) { if (ev.target === this.source) { @@ -156,6 +151,14 @@ var WebAudioSound = new Class({ this.source = null; } }, + applyConfig: function () { + this.rateUpdates.length = 0; + this.rateUpdates.push({ + time: 0, + rate: 1 + }); + BaseSound.prototype.applyConfig.call(this); + }, /** * Update method called on every game step. *