Using the same current time value for updating source playback rate and adding rate update item to the array

This commit is contained in:
Pavle Goloskokovic 2017-12-22 15:29:56 +01:00
parent 13d891893c
commit cd6b6bf574

View file

@ -250,12 +250,13 @@ var WebAudioSound = new Class({
*/
setRate: function () {
BaseSound.prototype.setRate.call(this);
var now = this.manager.context.currentTime;
if (this.source) {
this.source.playbackRate.setValueAtTime(this.totalRate, 0);
this.source.playbackRate.setValueAtTime(this.totalRate, now);
}
if (this.isPlaying) {
this.rateUpdates.push({
time: Math.max(this.startTime, this.manager.context.currentTime) - this.playTime,
time: Math.max(this.startTime, now) - this.playTime,
rate: this.totalRate
});
if (this.loopSource) {