Mercurial > hg > webaudioevaluationtool
changeset 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 |
files | ape.js core.js example_eval/project.xml |
diffstat | 3 files changed, 54 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Sat Jun 20 14:57:14 2015 +0100 +++ b/ape.js Sat Jun 20 16:57:06 2015 +0100 @@ -167,9 +167,11 @@ } for (var i=1; i<audioObjs.length; i++){ - var ranking = audioObjs[i].interfaceDOM.getValue(); - if (ranking < minRanking) { minRanking = ranking;} - if (ranking > maxRanking) { maxRanking = ranking;} + if (audioObjs[i].specification.type != 'outsidereference') { + var ranking = audioObjs[i].interfaceDOM.getValue(); + if (ranking < minRanking) { minRanking = ranking;} + if (ranking > maxRanking) { maxRanking = ranking;} + } } if (minRanking > minScale || maxRanking < maxScale) { alert('Please use the full width of the scale'); @@ -392,6 +394,31 @@ feedbackHolder.appendChild(node.holder); }); + // Construct outside reference; + if (audioHolderObject.outsideReference != null) { + var outsideReferenceHolder = document.createElement('div'); + outsideReferenceHolder.id = 'outside-reference'; + outsideReferenceHolderspan = document.createElement('span'); + outsideReferenceHolderspan.textContent = 'Reference'; + outsideReferenceHolder.appendChild(outsideReferenceHolderspan); + + var audioObject = audioEngineContext.newTrack(audioHolderObject.outsideReference); + + outsideReferenceHolder.onclick = function() + { + audioEngineContext.play(audioEngineContext.audioObjects.length-1); + $('.track-slider').removeClass('track-slider-playing'); + $('.comment-div').removeClass('comment-box-playing'); + if (event.srcElement.nodeName == 'DIV') { + $(event.srcElement).addClass('track-slider-playing'); + } else { + $(event.srcElement.parentElement).addClass('track-slider-playing'); + } + }; + + document.getElementById('interface-buttons').appendChild(outsideReferenceHolder); + } + testWaitIndicator(); } @@ -431,6 +458,9 @@ $(element).addClass('track-slider-playing'); $('.comment-div').removeClass('comment-box-playing'); $('#comment-div-'+id).addClass('comment-box-playing'); + var outsideReference = document.getElementById('outside-reference'); + if (outsideReference != undefined) + $(outsideReference).removeClass('track-slider-playing'); } };
--- 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) {
--- a/example_eval/project.xml Sat Jun 20 14:57:14 2015 +0100 +++ b/example_eval/project.xml Sat Jun 20 16:57:06 2015 +0100 @@ -50,13 +50,14 @@ <scale position="50">Middle</scale> <scale position="20">20</scale> <commentBoxPrefix>Comment on fragment</commentBoxPrefix> + <anchor>40</anchor> </interface> - <audioElements url="0.wav" id="0" type="anchor" marker="20"/> + <audioElements url="0.wav" id="0" type="anchor"/> <audioElements url="1.wav" id="1"/> <audioElements url="2.wav" id="2"/> <audioElements url="3.wav" id="3"/> - <!--<audioElements url="4.wav" id="4"/> - <audioElements url="5.wav" id="5"/> + <audioElements url="4.wav" id="4" type="outsidereference"/> + <!--<audioElements url="5.wav" id="5"/> <audioElements url="6.wav" id="6"/> <audioElements url="7.wav" id="7"/> <audioElements url="8.wav" id="8"/>