Skip to content

Commit 1779bcb

Browse files
Moved loop source creation logic into loop property setter
1 parent 8e9cc41 commit 1779bcb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ var WebAudioSound = new Class({
145145
this.playTime = when - seek;
146146
this.startTime = when;
147147
this.source = this.createBufferSource();
148-
if(this.currentConfig.loop) {
149-
this.loopSource = this.createBufferSource();
150-
}
151148
this.applyConfig();
152149
this.source.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration));
153150
this.resetConfig();
@@ -354,6 +351,9 @@ Object.defineProperty(WebAudioSound.prototype, 'loop', {
354351
},
355352
set: function (value) {
356353
this.currentConfig.loop = value;
354+
if(this.currentConfig.loop) {
355+
this.loopSource = this.createBufferSource();
356+
}
357357
}
358358
});
359359
module.exports = WebAudioSound;

0 commit comments

Comments
 (0)