Mercurial > hg > webaudioevaluationtool
changeset 1139:6f41badf6416
Feature #1504 Sample rate checks are now page wide and occur immediately after parsing the XML
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Tue, 12 Jan 2016 17:26:40 +0000 |
parents | 373a9fae8896 |
children | 8af1ee63510d |
files | core.js |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 = [];