comparison ape.js @ 2049:ce79548fb1f0

Updated #1272 and #1271 preparing for #1270
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Sat, 20 Jun 2015 14:57:14 +0100
parents 6118a9aea1f5
children dc531fbf64c3
comparison
equal deleted inserted replaced
2048:66fadacad41d 2049:ce79548fb1f0
353 353
354 currentTestHolder = document.createElement('audioHolder'); 354 currentTestHolder = document.createElement('audioHolder');
355 currentTestHolder.id = audioHolderObject.id; 355 currentTestHolder.id = audioHolderObject.id;
356 currentTestHolder.repeatCount = audioHolderObject.repeatCount; 356 currentTestHolder.repeatCount = audioHolderObject.repeatCount;
357 357
358 var randomise = audioHolderObject.randomiseOrder;
359
360 var audioElements = audioHolderObject.audioElements;
361 currentTrackOrder = [];
362 if (randomise) {
363 audioHolderObject.audioElements = randomiseOrder(audioHolderObject.audioElements);
364 }
365
366 // Delete any previous audioObjects associated with the audioEngine 358 // Delete any previous audioObjects associated with the audioEngine
367 audioEngineContext.audioObjects = []; 359 audioEngineContext.audioObjects = [];
368 interfaceContext.deleteCommentBoxes(); 360 interfaceContext.deleteCommentBoxes();
369 361
370 // Find all the audioElements from the audioHolder 362 // Find all the audioElements from the audioHolder
478 { 470 {
479 var checks = testState.currentStateMap[testState.currentIndex].interfaces[0].options; 471 var checks = testState.currentStateMap[testState.currentIndex].interfaces[0].options;
480 var canContinue = true; 472 var canContinue = true;
481 473
482 // Check that the anchor and reference objects are correctly placed 474 // Check that the anchor and reference objects are correctly placed
483 var audioObjs = audioEngineContext.audioObjects; 475 if (interfaceContext.checkHiddenAnchor() == false) {return;}
484 var audioHolder = testState.stateMap[testState.stateIndex]; 476 if (interfaceContext.checkHiddenReference() == false) {return;}
485 var anchorId = null;
486 var referenceId = null;
487 for (var i=0; i<audioObjs.length; i++) {
488 if (audioObjs[i].specification.anchor == true && anchorId == null) {anchorId = i;}
489 if (audioObjs[i].specification.reference == true && referenceId == null) {referenceId = i;}
490 }
491 if (anchorId != null) {
492 if (audioObjs[anchorId].specification.marker != null) {
493 if (audioObjs[anchorId].interfaceDOM.getValue() > audioObjs[anchorId].specification.marker)
494 {
495 // Anchor is not set below
496 console.log('Anchor node not below marker value');
497 alert('Please keep listening');
498 return;
499 }
500 } else {
501 // No marker value given, ensure it is the minimum value
502 var anchorVal = audioObjs[anchorId].interfaceDOM.getValue();
503 for (var i=0; i<audioObjs.length; i++) {
504 if (i != anchorId) {
505 if (anchorVal > audioObjs[i].interfaceDOM.getValue()) {
506 // Anchor not the minimum
507 console.log('No marker set, anchor node not the minimum');
508 alert('Please keep listening');
509 return;
510 }
511 }
512 }
513 }
514 }
515 if (referenceId != null) {
516 if (audioObjs[referenceId].specification.marker != null) {
517 if (audioObjs[referenceId].interfaceDOM.getValue() < audioObjs[referenceId].specification.marker)
518 {
519 // Anchor is not set below
520 console.log('Reference node not above marker value');
521 alert('Please keep listening');
522 return;
523 }
524 } else {
525 // No marker value given, ensure it is the minimum value
526 var referenceVal = audioObjs[referenceId].interfaceDOM.getValue();
527 for (var i=0; i<audioObjs.length; i++) {
528 if (i != referenceId) {
529 if (referenceVal > audioObjs[i].interfaceDOM.getValue()) {
530 // Anchor not the minimum
531 console.log('No marker set, reference node not the maximum');
532 alert('Please keep listening');
533 return;
534 }
535 }
536 }
537 }
538 }
539 477
540 for (var i=0; i<checks.length; i++) { 478 for (var i=0; i<checks.length; i++) {
541 if (checks[i].type == 'check') 479 if (checks[i].type == 'check')
542 { 480 {
543 switch(checks[i].check) { 481 switch(checks[i].check) {