# HG changeset patch # User Nicholas Jillings # Date 1434555452 -3600 # Node ID 8c44e2d0d6c49c4b78770464e98505af48ade294 # Parent 716cd1efe64c41353fa8bb7266a2c7de5c31959b Feature #1271 and #1272 implemented. diff -r 716cd1efe64c -r 8c44e2d0d6c4 ape.js --- a/ape.js Wed Jun 17 15:53:57 2015 +0100 +++ b/ape.js Wed Jun 17 16:37:32 2015 +0100 @@ -82,7 +82,7 @@ return false; } return true; - } + }; Interface.prototype.checkAllMoved = function() { var audioObjs = audioEngineContext.audioObjects; @@ -112,7 +112,7 @@ } } return state; - } + }; Interface.prototype.checkAllCommented = function() { var audioObjs = audioEngineContext.audioObjects; @@ -145,7 +145,7 @@ } } return state; - } + }; // Bindings for audioObjects @@ -410,12 +410,15 @@ } }; - this.exportXMLDOM = function() { + this.exportXMLDOM = function(audioObject) { // Called by the audioObject holding this element. Must be present var node = document.createElement('value'); node.textContent = convSliderPosToRate(this.trackSliderObj); return node; }; + this.getValue = function() { + return convSliderPosToRate(this.trackSliderObj); + } } function dragEnd(ev) { @@ -443,6 +446,65 @@ { var checks = specification.commonInterface.options; var canContinue = true; + + // Check that the anchor and reference objects are correctly placed + var audioObjs = audioEngineContext.audioObjects; + var audioHolder = testState.stateMap[testState.stateIndex]; + var anchorId = null; + var referenceId = null; + for (var i=0; i audioObjs[anchorId].specification.marker) + { + // Anchor is not set below + console.log('Anchor node not below marker value'); + alert('Please keep listening'); + return; + } + } else { + // No marker value given, ensure it is the minimum value + var anchorVal = audioObjs[anchorId].interfaceDOM.getValue(); + for (var i=0; i audioObjs[i].interfaceDOM.getValue()) { + // Anchor not the minimum + console.log('No marker set, anchor node not the minimum'); + alert('Please keep listening'); + return; + } + } + } + } + } + if (referenceId != null) { + if (audioObjs[referenceId].specification.marker != null) { + if (audioObjs[referenceId].interfaceDOM.getValue() < audioObjs[referenceId].specification.marker) + { + // Anchor is not set below + console.log('Reference node not above marker value'); + alert('Please keep listening'); + return; + } + } else { + // No marker value given, ensure it is the minimum value + var referenceVal = audioObjs[referenceId].interfaceDOM.getValue(); + for (var i=0; i audioObjs[i].interfaceDOM.getValue()) { + // Anchor not the minimum + console.log('No marker set, reference node not the maximum'); + alert('Please keep listening'); + return; + } + } + } + } + } + for (var i=0; i 1 && anchor < 100) {anchor /= 100.0;} + } + + if (typeof(reference) == 'number') { + if (reference > 1 && reference < 100) {reference /= 100.0;} } this.preTest = new parent.prepostNode('pretest',xml.getElementsByTagName('PreTest')); @@ -1484,6 +1498,34 @@ this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); } + // Check only one anchor and one reference per audioNode + var anchor = []; + var reference = []; + for (var i=0; i 1) { + console.log('Error - cannot have more than one anchor!'); + console.log('Each anchor node will be a normal mode to continue the test'); + for (var i=0; i 1) { + console.log('Error - cannot have more than one anchor!'); + console.log('Each anchor node will be a normal mode to continue the test'); + for (var i=0; ielementListenTracker - + 20 + 80 @@ -93,8 +94,8 @@ 75 Comment on fragment - - + +