Renamed createLoopBufferSource to createAndStartLoopBufferSource and added some logic for starting loop source

This commit is contained in:
Pavle Goloskokovic 2017-12-12 20:00:04 +01:00
parent d13bdfde62
commit dbc4b8b6f2

View file

@ -145,8 +145,11 @@ var WebAudioSound = new Class({
/** /**
* @private * @private
*/ */
createLoopBufferSource: function () { createAndStartLoopBufferSource: function () {
this.loopSource = this.createBufferSource(); 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. * Used internally to do what the name says.