# HG changeset patch # User Nicholas Jillings # Date 1432548852 -3600 # Node ID dcb042ed9d76812c64cd0283ff65b0c871cc75d2 # Parent 4d8846186db4913174f5191fbcef5f0bbc6dd59a Fix Bug #1241 and #1213: Added checks each time new test page is loaded that all audioObjects have decoded. Writes to browser console WAIT and does not issue any play command if any audioObjects not ready. diff -r 4d8846186db4 -r dcb042ed9d76 ape.js --- a/ape.js Mon May 25 10:06:28 2015 +0100 +++ b/ape.js Mon May 25 11:14:12 2015 +0100 @@ -265,8 +265,7 @@ { // Reset audioEngineContext.Metric globals for new test - audioEngineContext.metric.lastClicked = -1; - audioEngineContext.metric.data = -1; + audioEngineContext.newTestPage(); // Used to load a specific test page var textXML = testXMLSetups[id]; @@ -341,37 +340,6 @@ loopPlayback = false; // Create AudioEngine bindings for playback if (loopPlayback) { - audioEngineContext.play = function() { - // Send play command to all playback buffers for synchronised start - // Also start timer callbacks to detect if playback has finished - if (this.status == 0) { - this.timer.startTest(); - // First get current clock - var timer = audioContext.currentTime; - // Add 3 seconds - timer += 3.0; - // Send play to all tracks - for (var i=0; i 0) diff -r 4d8846186db4 -r dcb042ed9d76 core.js --- a/core.js Mon May 25 10:06:28 2015 +0100 +++ b/core.js Mon May 25 11:14:12 2015 +0100 @@ -105,6 +105,7 @@ // Use this to detect playback state: 0 - stopped, 1 - playing this.status = 0; + this.audioObjectsReady = false; // Connect both gains to output this.outputGain.connect(audioContext.destination); @@ -120,9 +121,30 @@ // Create store for new audioObjects this.audioObjects = []; - this.play = function(){}; + this.play = function() { + // Start the timer and set the audioEngine state to playing (1) + if (this.status == 0) { + // Check if all audioObjects are ready + if (this.audioObjectsReady == false) { + this.audioObjectsReady = this.checkAllReady(); + } + if (this.audioObjectsReady == true) { + this.timer.startTest(); + this.status = 1; + } + } + }; - this.stop = function(){}; + this.stop = function() { + // Send stop and reset command to all playback buffers and set audioEngine state to stopped (1) + if (this.status == 1) { + for (var i=0; i Please listen to all mixes - Please enter your name. - Please enter your listening location (Yellow Room/SSL Duality or Red Room/Neve VR). - Please enter your name. - Please enter your listening location (Yellow Room/SSL Duality or Red Room/Neve VR). Thank you for taking this listening test. @@ -21,7 +17,7 @@ elementFlagMoved - + Example Test Question Min @@ -45,8 +41,6 @@ Start the Test 3 - How did you find the test - How would you describe the genre of this song? Multiple answers possible. - + \ No newline at end of file diff -r 4d8846186db4 -r dcb042ed9d76 index.html --- a/index.html Mon May 25 10:06:28 2015 +0100 +++ b/index.html Mon May 25 11:14:12 2015 +0100 @@ -26,7 +26,7 @@