Skip to content

Commit cd6b6bf

Browse files
Using the same current time value for updating source playback rate and adding rate update item to the array
1 parent 13d8918 commit cd6b6bf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,13 @@ var WebAudioSound = new Class({
250250
*/
251251
setRate: function () {
252252
BaseSound.prototype.setRate.call(this);
253+
var now = this.manager.context.currentTime;
253254
if (this.source) {
254-
this.source.playbackRate.setValueAtTime(this.totalRate, 0);
255+
this.source.playbackRate.setValueAtTime(this.totalRate, now);
255256
}
256257
if (this.isPlaying) {
257258
this.rateUpdates.push({
258-
time: Math.max(this.startTime, this.manager.context.currentTime) - this.playTime,
259+
time: Math.max(this.startTime, now) - this.playTime,
259260
rate: this.totalRate
260261
});
261262
if (this.loopSource) {

0 commit comments

Comments
 (0)