comparison core.js @ 1339:259a0cb6e805

Feature #1504 Sample rate checks are now page wide and occur immediately after parsing the XML
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Tue, 12 Jan 2016 17:26:40 +0000
parents 6cd9c2bce083
children 8af1ee63510d
comparison
equal deleted inserted replaced
1338:6cd9c2bce083 1339:259a0cb6e805
124 } 124 }
125 125
126 // Build the specification 126 // Build the specification
127 specification.decode(projectXML); 127 specification.decode(projectXML);
128 storage.initialise(); 128 storage.initialise();
129 /// CHECK FOR SAMPLE RATE COMPATIBILITY
130 if (specification.sampleRate != undefined) {
131 if (Number(specification.sampleRate) != audioContext.sampleRate) {
132 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.';
133 alert(errStr);
134 return;
135 }
136 }
129 137
130 // Detect the interface to use and load the relevant javascripts. 138 // Detect the interface to use and load the relevant javascripts.
131 var interfaceJS = document.createElement('script'); 139 var interfaceJS = document.createElement('script');
132 interfaceJS.setAttribute("type","text/javascript"); 140 interfaceJS.setAttribute("type","text/javascript");
133 switch(specification.interface) 141 switch(specification.interface)
2161 this.insertPoint = document.getElementById("topLevelBody"); 2169 this.insertPoint = document.getElementById("topLevelBody");
2162 2170
2163 this.newPage = function(audioHolderObject,store) 2171 this.newPage = function(audioHolderObject,store)
2164 { 2172 {
2165 audioEngineContext.newTestPage(store); 2173 audioEngineContext.newTestPage(store);
2166 /// CHECK FOR SAMPLE RATE COMPATIBILITY
2167 if (audioHolderObject.sampleRate != undefined) {
2168 if (Number(audioHolderObject.sampleRate) != audioContext.sampleRate) {
2169 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.';
2170 alert(errStr);
2171 return;
2172 }
2173 }
2174
2175 audioEngineContext.loopPlayback = audioHolderObject.loop; 2174 audioEngineContext.loopPlayback = audioHolderObject.loop;
2176 // Delete any previous audioObjects associated with the audioEngine 2175 // Delete any previous audioObjects associated with the audioEngine
2177 audioEngineContext.audioObjects = []; 2176 audioEngineContext.audioObjects = [];
2178 interfaceContext.deleteCommentBoxes(); 2177 interfaceContext.deleteCommentBoxes();
2179 interfaceContext.deleteCommentQuestions(); 2178 interfaceContext.deleteCommentQuestions();