# HG changeset patch # User www-data # Date 1476804174 -3600 # Node ID 04498bccfccfdf25d53c56156e5068f2934a7117 # Parent 52c819e710cabd807e5cc84375c1273f37833d51# Parent 9b536838a962568bf5442fd16082db66f8e4d8be Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool diff -r 52c819e710ca -r 04498bccfccf js/core.js --- a/js/core.js Thu Oct 13 11:23:13 2016 +0100 +++ b/js/core.js Tue Oct 18 16:22:54 2016 +0100 @@ -1361,7 +1361,7 @@ // because web audio will optimise and any route which does not go to the destination gets ignored. this.outputGain = audioContext.createGain(); this.fooGain = audioContext.createGain(); - this.fooGain.gain = 0; + this.fooGain.gain.value = 0; // Use this to detect playback state: 0 - stopped, 1 - playing this.status = 0; @@ -1381,6 +1381,14 @@ this.pageStore = null; + // Chrome 53+ Error solution + // Empty buffer for keep-alive + var nullBuffer = audioContext.createBuffer(1, audioContext.sampleRate, audioContext.sampleRate); + this.nullBufferSource = audioContext.createBufferSource(); + this.nullBufferSource.buffer = nullBuffer; + this.nullBufferSource.loop = true; + this.nullBufferSource.start(0); + // Create store for new audioObjects this.audioObjects = []; @@ -1745,6 +1753,7 @@ // Connect buffer to the audio graph this.outputGain.connect(audioEngineContext.outputGain); + audioEngineContext.nullBufferSource.connect(this.outputGain); // the audiobuffer is not designed for multi-start playback // When stopeed, the buffer node is deleted and recreated with the stored buffer. @@ -1833,9 +1842,10 @@ event.currentTarget.owner.stop(audioContext.currentTime + 1); } }; + this.outputGain.gain.cancelScheduledValues(audioContext.currentTime); if (!audioEngineContext.loopPlayback || !audioEngineContext.synchPlayback) { this.metric.startListening(audioEngineContext.timer.getTestTime()); - this.outputGain.gain.setValueAtTime(this.onplayGain, 0.0); + this.outputGain.gain.setValueAtTime(this.onplayGain, startTime); this.interfaceDOM.startPlayback(); } else { this.outputGain.gain.setValueAtTime(0.0, startTime); @@ -1858,7 +1868,7 @@ this.bufferNode.stop(stopTime); this.bufferNode = undefined; } - this.outputGain.gain.value = 0.0; + this.outputGain.gain.setValueAtTime(0.0, stopTime); this.interfaceDOM.stopPlayback(); };