From dbc4b8b6f2d40de57ff201818d7228bf78375349 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Tue, 12 Dec 2017 20:00:04 +0100 Subject: [PATCH] Renamed createLoopBufferSource to createAndStartLoopBufferSource and added some logic for starting loop source --- v3/src/sound/webaudio/WebAudioSound.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v3/src/sound/webaudio/WebAudioSound.js b/v3/src/sound/webaudio/WebAudioSound.js index ae2d9dbe4..0438ac685 100644 --- a/v3/src/sound/webaudio/WebAudioSound.js +++ b/v3/src/sound/webaudio/WebAudioSound.js @@ -145,8 +145,11 @@ var WebAudioSound = new Class({ /** * @private */ - createLoopBufferSource: function () { + createAndStartLoopBufferSource: function () { this.loopSource = this.createBufferSource(); + var offset = this.currentMarker ? this.currentMarker.start : 0; + var duration = this.duration; + this.loopSource.start(Math.max(0, this.startTime + duration), Math.max(0, offset), Math.max(0, duration)); }, /** * Used internally to do what the name says.