comparison core.js @ 591:537f391079ec Dev_main

Bug #1654 Fixed.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 09 Mar 2016 13:34:20 +0000
parents 5b125fb39142
children 770ef730872b b3404426839d
comparison
equal deleted inserted replaced
590:5b125fb39142 591:537f391079ec
308 } 308 }
309 document.getElementsByTagName("head")[0].appendChild(interfaceJS); 309 document.getElementsByTagName("head")[0].appendChild(interfaceJS);
310 310
311 // Create the audio engine object 311 // Create the audio engine object
312 audioEngineContext = new AudioEngine(specification); 312 audioEngineContext = new AudioEngine(specification);
313
314 $(specification.pages).each(function(index,elem){
315 $(elem.audioElements).each(function(i,audioElem){
316 var URL = elem.hostURL + audioElem.url;
317 var buffer = null;
318 for (var i=0; i<audioEngineContext.buffers.length; i++)
319 {
320 if (URL == audioEngineContext.buffers[i].url)
321 {
322 buffer = audioEngineContext.buffers[i];
323 break;
324 }
325 }
326 if (buffer == null)
327 {
328 buffer = new audioEngineContext.bufferObj();
329 buffer.getMedia(URL);
330 audioEngineContext.buffers.push(buffer);
331 }
332 });
333 });
334 } 313 }
335 314
336 function createProjectSave(destURL) { 315 function createProjectSave(destURL) {
337 // Save the data from interface into XML and send to destURL 316 // Save the data from interface into XML and send to destURL
338 // If destURL is null then download XML in client 317 // If destURL is null then download XML in client
813 for (var i=0; i<specification.pages.length; i++) 792 for (var i=0; i<specification.pages.length; i++)
814 { 793 {
815 if (specification.testPages <= i && specification.testPages != 0) {break;} 794 if (specification.testPages <= i && specification.testPages != 0) {break;}
816 this.stateMap.push(pageHolder[i]); 795 this.stateMap.push(pageHolder[i]);
817 storage.createTestPageStore(pageHolder[i]); 796 storage.createTestPageStore(pageHolder[i]);
797 for (var element of pageHolder[i].audioElements) {
798 var URL = pageHolder[i].hostURL + element.url;
799 var buffer = null;
800 for (var buffObj of audioEngineContext.buffers) {
801 if (URL == buffObj.url) {
802 buffer = buffObj;
803 break;
804 }
805 }
806 if (buffer == null) {
807 buffer = new audioEngineContext.bufferObj();
808 buffer.getMedia(URL);
809 audioEngineContext.buffers.push(buffer);
810 }
811 }
818 } 812 }
819 813
820 if (specification.preTest != null) {this.preTestSurvey = specification.preTest;} 814 if (specification.preTest != null) {this.preTestSurvey = specification.preTest;}
821 if (specification.postTest != null) {this.postTestSurvey = specification.postTest;} 815 if (specification.postTest != null) {this.postTestSurvey = specification.postTest;}
822 816