# HG changeset patch # User Nicholas Jillings # Date 1458834165 0 # Node ID f9e9d94c9b9a4cd6a5592b12d76734d96ff5fe65 # Parent 9ba8ad2dde010c793acac75aea38ba43942543f3 Started adding calibration modules. diff -r 9ba8ad2dde01 -r f9e9d94c9b9a core.js --- 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() diff -r 9ba8ad2dde01 -r f9e9d94c9b9a example_eval/project.xml --- 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 @@ - + Please enter your name.