Mercurial > hg > webaudioevaluationtool
comparison core.js @ 2185:e9212d745302
Started adding calibration modules.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Thu, 24 Mar 2016 15:42:45 +0000 |
parents | 9fa5e164b3ef |
children | b5db605914ab |
comparison
equal
deleted
inserted
replaced
2184:2943abc7ed7b | 2185:e9212d745302 |
---|---|
3063 this.object.appendChild(title); | 3063 this.object.appendChild(title); |
3064 | 3064 |
3065 this.object.appendChild(this.slider); | 3065 this.object.appendChild(this.slider); |
3066 this.object.appendChild(this.valueText); | 3066 this.object.appendChild(this.valueText); |
3067 } | 3067 } |
3068 | |
3069 this.calibrationModule = function() { | |
3070 // This creates an on-page calibration module | |
3071 this.storeDOM = storage.document.createElement("calibration"); | |
3072 storage.root.children[0].appendChild(this.storeDOM); | |
3073 // The calibration is a fixed state module | |
3074 this.calibrationNodes = []; | |
3075 var f0 = 62.5; | |
3076 while(f0 < 20000) { | |
3077 var obj = { | |
3078 root: document.createElement("div"), | |
3079 input: document.createElement("input"), | |
3080 oscillator: audioContext.createOscillator(), | |
3081 gain: audioContext.createGain(), | |
3082 parent: this, | |
3083 handleEvent: function(event) { | |
3084 gain.gain.value = Math.pow(10,input.value/20); | |
3085 }, | |
3086 disconnect: function() { | |
3087 this.gain.disconnect(); | |
3088 } | |
3089 } | |
3090 obj.root.appendChild(obj.input); | |
3091 obj.oscillator.connect(obj.gain); | |
3092 obj.gain.connect(audioContext.destination); | |
3093 obj.gain.gain.value = Math.random()*2; | |
3094 obj.input.value = obj.gain.gain.value; | |
3095 obj.input.type = "range"; | |
3096 obj.input.min = -60; | |
3097 obj.input.max = 12; | |
3098 obj.input.step = 0.25; | |
3099 obj.oscillator.frequency.value = f0; | |
3100 this.calibrationNodes.push(obj); | |
3101 f0 *= 2; | |
3102 } | |
3103 } | |
3104 | |
3105 | |
3068 // Global Checkers | 3106 // Global Checkers |
3069 // These functions will help enforce the checkers | 3107 // These functions will help enforce the checkers |
3070 this.checkHiddenAnchor = function() | 3108 this.checkHiddenAnchor = function() |
3071 { | 3109 { |
3072 for (var ao of audioEngineContext.audioObjects) | 3110 for (var ao of audioEngineContext.audioObjects) |