Mercurial > hg > webaudioevaluationtool
changeset 643:f9e9d94c9b9a Dev_main
Started adding calibration modules.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 24 Mar 2016 15:42:45 +0000 |
parents | 9ba8ad2dde01 |
children | e465cdd2ca38 |
files | core.js example_eval/project.xml |
diffstat | 2 files changed, 39 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Thu Mar 24 13:55:08 2016 +0000 +++ b/core.js Thu Mar 24 15:42:45 2016 +0000 @@ -3065,6 +3065,44 @@ this.object.appendChild(this.slider); this.object.appendChild(this.valueText); } + + this.calibrationModule = function() { + // This creates an on-page calibration module + this.storeDOM = storage.document.createElement("calibration"); + storage.root.children[0].appendChild(this.storeDOM); + // The calibration is a fixed state module + this.calibrationNodes = []; + var f0 = 62.5; + while(f0 < 20000) { + var obj = { + root: document.createElement("div"), + input: document.createElement("input"), + oscillator: audioContext.createOscillator(), + gain: audioContext.createGain(), + parent: this, + handleEvent: function(event) { + gain.gain.value = Math.pow(10,input.value/20); + }, + disconnect: function() { + this.gain.disconnect(); + } + } + obj.root.appendChild(obj.input); + obj.oscillator.connect(obj.gain); + obj.gain.connect(audioContext.destination); + obj.gain.gain.value = Math.random()*2; + obj.input.value = obj.gain.gain.value; + obj.input.type = "range"; + obj.input.min = -60; + obj.input.max = 12; + obj.input.step = 0.25; + obj.oscillator.frequency.value = f0; + this.calibrationNodes.push(obj); + f0 *= 2; + } + } + + // Global Checkers // These functions will help enforce the checkers this.checkHiddenAnchor = function()
--- a/example_eval/project.xml Thu Mar 24 13:55:08 2016 +0000 +++ b/example_eval/project.xml Thu Mar 24 15:42:45 2016 +0000 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd"> - <setup interface="APE" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100"> + <setup interface="APE" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100" calibration="true"> <survey location="before"> <surveyentry type="question" id="sessionId" mandatory="true"> <statement>Please enter your name.</statement>