Mercurial > hg > webaudioevaluationtool
changeset 603:640ffb822da1
Bug #1652 and Feature #1650 fixes. You can specify the track labels through page attribute 'label' ('default', 'none', 'number', 'letter', 'capital'). Updated examples to match schema
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 10 Mar 2016 16:16:16 +0000 |
parents | 6531e3903ea1 |
children | 96cb6735c9c2 |
files | core.js example_eval/AB_example.xml example_eval/mushra_example.xml example_eval/project.xml interfaces/AB.js interfaces/ape.js interfaces/discrete.js interfaces/horizontal-sliders.js interfaces/mushra.js test-schema.xsd |
diffstat | 10 files changed, 105 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Thu Mar 10 15:33:39 2016 +0000 +++ b/core.js Thu Mar 10 16:16:16 2016 +0000 @@ -2180,6 +2180,7 @@ this.showElementComments = undefined; this.outsideReference = null; this.loudness = null; + this.label = null; this.preTest = null; this.postTest = null; this.interfaces = [];
--- a/example_eval/AB_example.xml Thu Mar 10 15:33:39 2016 +0000 +++ b/example_eval/AB_example.xml Thu Mar 10 16:16:16 2016 +0000 @@ -13,7 +13,7 @@ <option name="hwdesigner">Designing or building audio hardware</option> <option name="researcher">Research in the field of audio</option> </surveyentry> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-intro"> <statement>This is an example of an 'AB'-style test, with two pages, using the test stimuli in 'example_eval/'.</statement> </surveyentry> </survey> @@ -31,7 +31,7 @@ <option name="good">Good</option> <option name="great">Great</option> </surveyentry> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-thank-you"> <statement>Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder.</statement> </surveyentry> </survey> @@ -60,7 +60,7 @@ <audioelement url="0.wav" id="track-0"/> <audioelement url="1.wav" id="track-1"/> <survey location="before"> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-0-intro"> <statement>A two way comparison using randomised element order, automatic loudness and synchronised looping.</statement> </surveyentry> </survey> @@ -83,7 +83,7 @@ <audioelement url="5.wav" id="track-7"/> <audioelement url="6.wav" id="track-8"/> <survey location="before"> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-1-intro"> <statement>A 7 way comparison using randomised element order and synchronised looping.</statement> </surveyentry> </survey>
--- a/example_eval/mushra_example.xml Thu Mar 10 15:33:39 2016 +0000 +++ b/example_eval/mushra_example.xml Thu Mar 10 16:16:16 2016 +0000 @@ -13,7 +13,7 @@ <option name="hwdesigner">Designing or building audio hardware</option> <option name="researcher">Research in the field of audio</option> </surveyentry> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-intro"> <statement>This is an example of an 'APE'-style test, with two pages, using the test stimuli in 'example_eval/'.</statement> </surveyentry> </survey> @@ -31,7 +31,7 @@ <option name="good">Good</option> <option name="great">Great</option> </surveyentry> - <surveyentry type="statement"> + <surveyentry type="statement" id="thankyou"> <statement>Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder.</statement> </surveyentry> </survey> @@ -71,7 +71,7 @@ <audioelement url="3.wav" id="track-3"/> <audioelement url="4.wav" id="track-4"/> <survey location="before"> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-0-intro"> <statement>Example of a 'MUSHRA' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75% using a Comparison Category Rating Scale.</statement> </surveyentry> </survey> @@ -118,7 +118,7 @@ <option name="heavy">Heavy</option> </commentquestion> <survey location="before"> - <surveyentry type="statement"> + <surveyentry type="statement" id="test-1-intro"> <statement>Example of a 'MUSHRA' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75%.</statement> </surveyentry> </survey>
--- a/example_eval/project.xml Thu Mar 10 15:33:39 2016 +0000 +++ b/example_eval/project.xml Thu Mar 10 16:16:16 2016 +0000 @@ -86,7 +86,7 @@ </surveyentry> </survey> </page> - <page id='test-1' hostURL="example_eval/" randomiseOrder='true' repeatCount='0' loop='false' showElementComments='true'> + <page id='test-1' hostURL="example_eval/" randomiseOrder='true' repeatCount='0' loop='false' showElementComments='true' label="none"> <commentboxprefix>Comment on fragment</commentboxprefix> <interface name="preference"> <title>Example Test Question</title>
--- a/interfaces/AB.js Thu Mar 10 15:33:39 2016 +0000 +++ b/interfaces/AB.js Thu Mar 10 16:16:16 2016 +0000 @@ -308,7 +308,22 @@ console.log("WARNING - AB cannot have fixed reference"); } var audioObject = audioEngineContext.newTrack(element); - var node = new this.comparatorBox(audioObject,index,String.fromCharCode(65 + index)); + var label; + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "number": + label = ""+index; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + default: + label = String.fromCharCode(65 + index); + break; + } + var node = new this.comparatorBox(audioObject,index,label); audioObject.bindInterface(node); this.comparators.push(node); this.boxHolders.appendChild(node.box);
--- a/interfaces/ape.js Thu Mar 10 15:33:39 2016 +0000 +++ b/interfaces/ape.js Thu Mar 10 16:16:16 2016 +0000 @@ -239,7 +239,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; // Append the interface buttons into the interfaceButtons object. @@ -535,7 +535,22 @@ this.canvas.appendChild(trackObj); this.sliders.push(trackObj); this.metrics.push(new metricTracker(this)); - trackObj.innerHTML = '<span>'+(this.metrics.length-1)+'</span>'; + var label = document.createElement("label"); + switch(audioObject.specification.parent.label) { + case "letter": + label.textContent = String.fromCharCode(97 + this.metrics.length-1); + break; + case "capital": + label.textContent = String.fromCharCode(65 + this.metrics.length-1); + break; + case "none": + label.textContent = ""; + break; + default: + label.textContent = ""+this.metrics.length; + break; + } + trackObj.appendChild(label); this.metrics[this.metrics.length-1].initialise(convSliderPosToRate(trackObj)); return trackObj; };
--- a/interfaces/discrete.js Thu Mar 10 15:33:39 2016 +0000 +++ b/interfaces/discrete.js Thu Mar 10 16:16:16 2016 +0000 @@ -55,7 +55,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -184,7 +184,7 @@ }); // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; var interfaceScales = testState.currentStateMap.interfaces[0].scales; $(page.audioElements).each(function(index,element){ // Find URL of track @@ -198,11 +198,25 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new discreteObject(audioObject,label,interfaceScales); sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } });
--- a/interfaces/horizontal-sliders.js Thu Mar 10 15:33:39 2016 +0000 +++ b/interfaces/horizontal-sliders.js Thu Mar 10 16:16:16 2016 +0000 @@ -55,7 +55,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -185,7 +185,7 @@ }); // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; $(page.audioElements).each(function(index,element){ // Find URL of track // In this jQuery loop, variable 'this' holds the current audioElement. @@ -198,6 +198,20 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new sliderObject(audioObject,label); if (typeof page.initialPosition === "number") @@ -211,7 +225,7 @@ sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } });
--- a/interfaces/mushra.js Thu Mar 10 15:33:39 2016 +0000 +++ b/interfaces/mushra.js Thu Mar 10 16:16:16 2016 +0000 @@ -61,7 +61,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -183,7 +183,7 @@ currentTestHolder.repeatCount = audioHolderObject.repeatCount; // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; $(audioHolderObject.audioElements).each(function(index,element){ // Find URL of track // In this jQuery loop, variable 'this' holds the current audioElement. @@ -196,6 +196,20 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new sliderObject(audioObject,label); if (typeof audioHolderObject.initialPosition === "number") @@ -209,7 +223,7 @@ sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } });
--- a/test-schema.xsd Thu Mar 10 15:33:39 2016 +0000 +++ b/test-schema.xsd Thu Mar 10 16:16:16 2016 +0000 @@ -53,6 +53,17 @@ <xs:attribute name="loop" type="xs:boolean" default="false"/> <xs:attribute name="showElementComments" type="xs:boolean" default="false"/> <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional"/> + <xs:attribute name="label" use="optional" default="default"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="default"/> + <xs:enumeration value="none"/> + <xs:enumeration value="number"/> + <xs:enumeration value="letter"/> + <xs:enumeration value="capital"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> </xs:complexType> </xs:element>