# HG changeset patch # User Nicholas Jillings # Date 1452619600 0 # Node ID 6f41badf6416a3c8e348dd6ab16c8710d0284773 # Parent 373a9fae8896cf8ac4d68d0ca474bd6892416fb9 Feature #1504 Sample rate checks are now page wide and occur immediately after parsing the XML diff -r 373a9fae8896 -r 6f41badf6416 core.js --- a/core.js Tue Jan 12 17:10:39 2016 +0000 +++ b/core.js Tue Jan 12 17:26:40 2016 +0000 @@ -126,6 +126,14 @@ // Build the specification specification.decode(projectXML); storage.initialise(); + /// CHECK FOR SAMPLE RATE COMPATIBILITY + if (specification.sampleRate != undefined) { + if (Number(specification.sampleRate) != audioContext.sampleRate) { + var errStr = 'Sample rates do not match! Requested '+Number(specification.sampleRate)+', got '+audioContext.sampleRate+'. Please set the sample rate to match before completing this test.'; + alert(errStr); + return; + } + } // Detect the interface to use and load the relevant javascripts. var interfaceJS = document.createElement('script'); @@ -2163,15 +2171,6 @@ this.newPage = function(audioHolderObject,store) { audioEngineContext.newTestPage(store); - /// CHECK FOR SAMPLE RATE COMPATIBILITY - if (audioHolderObject.sampleRate != undefined) { - if (Number(audioHolderObject.sampleRate) != audioContext.sampleRate) { - var errStr = 'Sample rates do not match! Requested '+Number(audioHolderObject.sampleRate)+', got '+audioContext.sampleRate+'. Please set the sample rate to match before completing this test.'; - alert(errStr); - return; - } - } - audioEngineContext.loopPlayback = audioHolderObject.loop; // Delete any previous audioObjects associated with the audioEngine audioEngineContext.audioObjects = [];