Mercurial > hg > webaudioevaluationtool
changeset 766:7c937cc3bc53
Bug #1485: Core.js patches from side revision.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Tue, 08 Dec 2015 12:21:01 +0000 |
parents | e66434e0f573 |
children | 3123565e0c49 |
files | core.js |
diffstat | 1 files changed, 22 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Tue Dec 08 12:18:06 2015 +0100 +++ b/core.js Tue Dec 08 12:21:01 2015 +0000 @@ -649,7 +649,6 @@ this.testPageCompleted = function(store, testXML, testId) { // Function called each time a test page has been completed - // Can be used to over-rule default behaviour var metric = document.createElement('metric'); if (audioEngineContext.metric.enableTestTimer) { @@ -658,17 +657,17 @@ testTime.textContent = audioEngineContext.timer.testDuration; metric.appendChild(testTime); } - testXML.appendChild(metric); + store.appendChild(metric); var audioObjects = audioEngineContext.audioObjects; for (var i=0; i<audioObjects.length; i++) { var audioElement = audioEngineContext.audioObjects[i].exportXMLDOM(); audioElement.setAttribute('presentedId',i); - testXML.appendChild(audioElement); + store.appendChild(audioElement); } $(interfaceContext.commentQuestions).each(function(index,element){ var node = element.exportXMLDOM(); - testXML.appendChild(node); + store.appendChild(node); }); pageXMLSave(store, testXML); }; @@ -914,10 +913,10 @@ var maxId; for (var i=0; i<this.audioObjects.length; i++) { - lens.push(this.audioObjects[i].buffer.length); - if (length < this.audioObjects[i].buffer.length) + lens.push(this.audioObjects[i].buffer.buffer.length); + if (length < this.audioObjects[i].buffer.buffer.length) { - length = this.audioObjects[i].buffer.length; + length = this.audioObjects[i].buffer.buffer.length; maxId = i; } } @@ -929,7 +928,7 @@ // Extract the audio and zero-pad for (var i=0; i<lens.length; i++) { - var orig = this.audioObjects[i].buffer; + var orig = this.audioObjects[i].buffer.buffer; var hold = audioContext.createBuffer(orig.numberOfChannels,length,orig.sampleRate); for (var c=0; c<orig.numberOfChannels; c++) { @@ -938,7 +937,7 @@ for (var n=0; n<orig.length; n++) {inData[n] = outData[n];} } - this.audioObjects[i].buffer = hold; + this.audioObjects[i].buffer.buffer = hold; delete orig; } }; @@ -1077,7 +1076,15 @@ file.setAttribute('duration',this.buffer.duration); root.appendChild(file); if (this.specification.type != 'outsidereference') { - root.appendChild(this.interfaceDOM.exportXMLDOM(this)); + var interfaceXML = this.interfaceDOM.exportXMLDOM(this); + if (interfaceXML.length == undefined) { + root.appendChild(); + } else { + for (var i=0; i<interfaceXML.length; i++) + { + root.appendChild(interfaceXML[i]); + } + } root.appendChild(this.commentDOM.exportXMLDOM(this)); if(this.specification.type == 'anchor') { root.setAttribute('anchor',true); @@ -1503,6 +1510,7 @@ } this.commonInterface = new function() { + this.name = undefined; this.OptionNode = function(child) { this.type = child.nodeName; if (this.type == 'option') @@ -1536,6 +1544,10 @@ }; this.options = []; if (commonInterfaceNode != undefined) { + var name = commonInterfaceNode.getAttribute("name"); + if (name != undefined) { + this.name = name; + } var child = commonInterfaceNode.firstElementChild; while (child != undefined) { this.options.push(new this.OptionNode(child));