# HG changeset patch # User Nicholas Jillings # Date 1458834165 0 # Node ID e9212d7453022444e6214b681816c06e8e87ec8a # Parent 2943abc7ed7b755a98b2b9626c84fd026e2f5918 Started adding calibration modules. diff -r 2943abc7ed7b -r e9212d745302 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 2943abc7ed7b -r e9212d745302 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.