Fixed issue with changing rate on a sound with delayed playback

This commit is contained in:
Pavle Goloskokovic 2017-12-14 14:04:05 +01:00
parent 0c84f78e9e
commit 06362216d1

View file

@ -205,15 +205,17 @@ var WebAudioSound = new Class({
this.source.playbackRate.setValueAtTime(this.totalRate, 0); this.source.playbackRate.setValueAtTime(this.totalRate, 0);
} }
if (this.isPlaying) { if (this.isPlaying) {
var time = void 0;
if (this.manager.context.currentTime < this.startTime) { if (this.manager.context.currentTime < this.startTime) {
this.rateUpdates[this.rateUpdates.length - 1].rate = this.totalRate; time = this.startTime - this.playTime;
} }
else { else {
this.rateUpdates.push({ time = this.manager.context.currentTime - this.playTime;
time: this.manager.context.currentTime - this.playTime,
rate: this.totalRate
});
} }
this.rateUpdates.push({
time: time,
rate: this.totalRate
});
} }
}, },
/** /**