Mercurial > hg > webaudioevaluationtool
comparison core.js @ 2050:acf57b56634a
Starting on Outside Reference. Implemented but needs tidying up GUI and returned XML
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Sat, 20 Jun 2015 16:57:06 +0100 |
parents | ce79548fb1f0 |
children | cb060b4e73c4 |
comparison
equal
deleted
inserted
replaced
2049:ce79548fb1f0 | 2050:acf57b56634a |
---|---|
892 var root = document.createElement('audioElement'); | 892 var root = document.createElement('audioElement'); |
893 root.id = this.specification.id; | 893 root.id = this.specification.id; |
894 root.setAttribute('url',this.url); | 894 root.setAttribute('url',this.url); |
895 var file = document.createElement('file'); | 895 var file = document.createElement('file'); |
896 file.setAttribute('sampleRate',this.buffer.sampleRate); | 896 file.setAttribute('sampleRate',this.buffer.sampleRate); |
897 file.setAttribute('channels',this.buffer.channels); | 897 file.setAttribute('channels',this.buffer.numberOfChannels); |
898 file.setAttribute('sampleCount',this.buffer.length); | 898 file.setAttribute('sampleCount',this.buffer.length); |
899 file.setAttribute('duration',this.buffer.duration); | 899 file.setAttribute('duration',this.buffer.duration); |
900 root.appendChild(file); | 900 root.appendChild(file); |
901 root.appendChild(this.interfaceDOM.exportXMLDOM(this)); | 901 if (this.specification.type != 'outsidereference') { |
902 root.appendChild(this.commentDOM.exportXMLDOM(this)); | 902 root.appendChild(this.interfaceDOM.exportXMLDOM(this)); |
903 root.appendChild(this.commentDOM.exportXMLDOM(this)); | |
904 } | |
903 root.appendChild(this.metric.exportXMLDOM()); | 905 root.appendChild(this.metric.exportXMLDOM()); |
904 return root; | 906 return root; |
905 }; | 907 }; |
906 } | 908 } |
907 | 909 |
1514 this.commentBoxPrefix = "Comment on track"; | 1516 this.commentBoxPrefix = "Comment on track"; |
1515 } | 1517 } |
1516 | 1518 |
1517 this.audioElements =[]; | 1519 this.audioElements =[]; |
1518 var audioElementsDOM = xml.getElementsByTagName('audioElements'); | 1520 var audioElementsDOM = xml.getElementsByTagName('audioElements'); |
1521 this.outsideReference = null; | |
1519 for (var i=0; i<audioElementsDOM.length; i++) { | 1522 for (var i=0; i<audioElementsDOM.length; i++) { |
1520 this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); | 1523 if (audioElementsDOM[i].getAttribute('type') == 'outsidereference') { |
1524 if (this.outsideReference == null) { | |
1525 this.outsideReference = new this.audioElementNode(this,audioElementsDOM[i]); | |
1526 } else { | |
1527 console.log('Error only one audioelement can be of type outsidereference per audioholder'); | |
1528 this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); | |
1529 console.log('Element id '+audioElementsDOM[i].id+' made into normal node'); | |
1530 } | |
1531 } else { | |
1532 this.audioElements.push(new this.audioElementNode(this,audioElementsDOM[i])); | |
1533 } | |
1521 } | 1534 } |
1522 | 1535 |
1523 if (this.randomiseOrder) { | 1536 if (this.randomiseOrder) { |
1524 this.audioElements = randomiseOrder(this.audioElements); | 1537 this.audioElements = randomiseOrder(this.audioElements); |
1525 } | 1538 } |