# HG changeset patch # User www-data # Date 1478701257 0 # Node ID 6461c20123403f8c51b7e8abaecf57d9b2319fa7 # Parent 78a6c78ba4fd700754e4de8d7ab46ee80a201931# Parent 21110fddb0af7d7ea59c59fe6cd69bdd8b483a85 Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool diff -r 78a6c78ba4fd -r 6461c2012340 js/core.js --- a/js/core.js Wed Nov 09 13:20:49 2016 +0000 +++ b/js/core.js Wed Nov 09 14:20:57 2016 +0000 @@ -1584,22 +1584,21 @@ } else { interfaceContext.playhead.setTimePerPixel(this.audioObjects[id]); } + var setTime = audioContext.currentTime; if (this.synchPlayback && this.loopPlayback) { // Traditional looped playback - var setTime = audioContext.currentTime + specification.crossFade; for (var i = 0; i < this.audioObjects.length; i++) { this.audioObjects[i].play(audioContext.currentTime); if (id == i) { this.audioObjects[i].loopStart(setTime); } else { - this.audioObjects[i].loopStop(setTime); + this.audioObjects[i].loopStop(setTime + specification.crossFade); } } } else { - var setTime = audioContext.currentTime + specification.crossFade; for (var i = 0; i < this.audioObjects.length; i++) { if (i != id) { - this.audioObjects[i].stop(setTime); + this.audioObjects[i].stop(setTime + specification.crossFade); } else if (i == id) { this.audioObjects[id].play(setTime); } @@ -1845,10 +1844,10 @@ this.outputGain.gain.cancelScheduledValues(audioContext.currentTime); if (!audioEngineContext.loopPlayback || !audioEngineContext.synchPlayback) { this.metric.startListening(audioEngineContext.timer.getTestTime()); - this.outputGain.gain.setValueAtTime(this.onplayGain, startTime); + this.outputGain.gain.linearRampToValueAtTime(this.onplayGain, startTime + specification.crossFade); this.interfaceDOM.startPlayback(); } else { - this.outputGain.gain.setValueAtTime(0.0, startTime); + this.outputGain.gain.linearRampToValueAtTime(0.0, startTime); } if (audioEngineContext.loopPlayback) { this.bufferNode.loopStart = this.specification.startTime || 0; @@ -1868,7 +1867,7 @@ this.bufferNode.stop(stopTime); this.bufferNode = undefined; } - this.outputGain.gain.setValueAtTime(0.0, stopTime); + this.outputGain.gain.linearRampToValueAtTime(0.0, stopTime); this.interfaceDOM.stopPlayback(); };