Mercurial > hg > webaudioevaluationtool
diff core.js @ 1044:dc531fbf64c3
Starting on Outside Reference. Implemented but needs tidying up GUI and returned XML
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Sat, 20 Jun 2015 16:57:06 +0100 |
parents | f6e8b7156017 |
children | cb060b4e73c4 |
line wrap: on
line diff
--- a/core.js Sat Jun 20 14:57:14 2015 +0100 +++ b/core.js Sat Jun 20 16:57:06 2015 +0100 @@ -894,12 +894,14 @@ root.setAttribute('url',this.url); var file = document.createElement('file'); file.setAttribute('sampleRate',this.buffer.sampleRate); - file.setAttribute('channels',this.buffer.channels); + file.setAttribute('channels',this.buffer.numberOfChannels); file.setAttribute('sampleCount',this.buffer.length); file.setAttribute('duration',this.buffer.duration); root.appendChild(file); - root.appendChild(this.interfaceDOM.exportXMLDOM(this)); - root.appendChild(this.commentDOM.exportXMLDOM(this)); + if (this.specification.type != 'outsidereference') { + root.appendChild(this.interfaceDOM.exportXMLDOM(this)); + root.appendChild(this.commentDOM.exportXMLDOM(this)); + } root.appendChild(this.metric.exportXMLDOM()); return root; }; @@ -1516,8 +1518,19 @@ this.audioElements =[]; var audioElementsDOM = xml.getElementsByTagName('audioElements'); + this.outsideReference = null; for (var i=0; i<audioElementsDOM.length; i++) { - this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); + if (audioElementsDOM[i].getAttribute('type') == 'outsidereference') { + if (this.outsideReference == null) { + this.outsideReference = new this.audioElementNode(this,audioElementsDOM[i]); + } else { + console.log('Error only one audioelement can be of type outsidereference per audioholder'); + this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); + console.log('Element id '+audioElementsDOM[i].id+' made into normal node'); + } + } else { + this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); + } } if (this.randomiseOrder) {