Skip to content

Commit 0636221

Browse files
Fixed issue with changing rate on a sound with delayed playback
1 parent 0c84f78 commit 0636221

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,17 @@ var WebAudioSound = new Class({
205205
this.source.playbackRate.setValueAtTime(this.totalRate, 0);
206206
}
207207
if (this.isPlaying) {
208+
var time = void 0;
208209
if (this.manager.context.currentTime < this.startTime) {
209-
this.rateUpdates[this.rateUpdates.length - 1].rate = this.totalRate;
210+
time = this.startTime - this.playTime;
210211
}
211212
else {
212-
this.rateUpdates.push({
213-
time: this.manager.context.currentTime - this.playTime,
214-
rate: this.totalRate
215-
});
213+
time = this.manager.context.currentTime - this.playTime;
216214
}
215+
this.rateUpdates.push({
216+
time: time,
217+
rate: this.totalRate
218+
});
217219
}
218220
},
219221
/**

0 commit comments

Comments
 (0)