Skip to content

Commit 4538ee9

Browse files
Calculating when, offset and duration parameters for buffer source start method and calling it in loop setter method
1 parent 1779bcb commit 4538ee9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,12 @@ Object.defineProperty(WebAudioSound.prototype, 'loop', {
351351
},
352352
set: function (value) {
353353
this.currentConfig.loop = value;
354-
if(this.currentConfig.loop) {
354+
if(value) {
355+
var when = 0;
356+
var offset = this.currentMarker ? this.currentMarker.start : 0;
357+
var duration = this.duration;
355358
this.loopSource = this.createBufferSource();
359+
this.loopSource.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration));
356360
}
357361
}
358362
});

0 commit comments

Comments
 (0)