Mercurial > hg > webaudioevaluationtool
comparison ape.js @ 375:81246d594793 Dev_main
Moved common test options into core.JS
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Mon, 07 Dec 2015 11:18:11 +0000 |
parents | ed22a47dcacd |
children | f49339868324 |
comparison
equal
deleted
inserted
replaced
374:6139c53deba1 | 375:81246d594793 |
---|---|
313 | 313 |
314 } | 314 } |
315 | 315 |
316 function loadTest(audioHolderObject) | 316 function loadTest(audioHolderObject) |
317 { | 317 { |
318 | 318 |
319 // Reset audioEngineContext.Metric globals for new test | |
320 audioEngineContext.newTestPage(); | |
321 | |
322 var id = audioHolderObject.id; | 319 var id = audioHolderObject.id; |
323 | 320 |
324 var feedbackHolder = document.getElementById('feedbackHolder'); | 321 var feedbackHolder = document.getElementById('feedbackHolder'); |
325 var canvas = document.getElementById('slider'); | 322 var canvas = document.getElementById('slider'); |
326 feedbackHolder.innerHTML = null; | 323 feedbackHolder.innerHTML = null; |
383 | 380 |
384 if (interfaceObj.commentBoxPrefix != undefined) { | 381 if (interfaceObj.commentBoxPrefix != undefined) { |
385 commentBoxPrefix = interfaceObj.commentBoxPrefix; | 382 commentBoxPrefix = interfaceObj.commentBoxPrefix; |
386 } | 383 } |
387 } | 384 } |
388 | |
389 /// CHECK FOR SAMPLE RATE COMPATIBILITY | |
390 if (audioHolderObject.sampleRate != undefined) { | |
391 if (Number(audioHolderObject.sampleRate) != audioContext.sampleRate) { | |
392 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.'; | |
393 alert(errStr); | |
394 return; | |
395 } | |
396 } | |
397 | 385 |
398 var commentShow = audioHolderObject.elementComments; | 386 var commentShow = audioHolderObject.elementComments; |
399 | 387 |
400 var loopPlayback = audioHolderObject.loop; | 388 var loopPlayback = audioHolderObject.loop; |
401 | 389 |
402 audioEngineContext.loopPlayback = loopPlayback; | |
403 // Create AudioEngine bindings for playback | |
404 | |
405 currentTestHolder = document.createElement('audioHolder'); | 390 currentTestHolder = document.createElement('audioHolder'); |
406 currentTestHolder.id = audioHolderObject.id; | 391 currentTestHolder.id = audioHolderObject.id; |
407 currentTestHolder.repeatCount = audioHolderObject.repeatCount; | 392 currentTestHolder.repeatCount = audioHolderObject.repeatCount; |
408 | |
409 // Delete any previous audioObjects associated with the audioEngine | |
410 audioEngineContext.audioObjects = []; | |
411 interfaceContext.deleteCommentBoxes(); | |
412 interfaceContext.deleteCommentQuestions(); | |
413 | 393 |
414 // Find all the audioElements from the audioHolder | 394 // Find all the audioElements from the audioHolder |
415 $(audioHolderObject.audioElements).each(function(index,element){ | 395 $(audioHolderObject.audioElements).each(function(index,element){ |
416 // Find URL of track | 396 // Find URL of track |
417 // In this jQuery loop, variable 'this' holds the current audioElement. | 397 // In this jQuery loop, variable 'this' holds the current audioElement. |