comparison js/core.js @ 2708:2395223deef2

Merge branch 'master' into vnext # Conflicts: # js/core.js
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 28 Mar 2017 13:04:29 +0100
parents 4125da39666e a513533565cf
children 898a6da5ff6c 2dfc19a33bbc
comparison
equal deleted inserted replaced
2707:4125da39666e 2708:2395223deef2
3010 3010
3011 this.slider.min = -60; 3011 this.slider.min = -60;
3012 this.slider.max = 12; 3012 this.slider.max = 12;
3013 this.slider.value = 0; 3013 this.slider.value = 0;
3014 this.slider.step = 1; 3014 this.slider.step = 1;
3015 this.slider.onmousemove = function (event) { 3015 this.handleEvent = function (event) {
3016 interfaceContext.volume.valueDB = event.currentTarget.value; 3016 if (event.type == "mousemove") {
3017 interfaceContext.volume.valueLin = decibelToLinear(interfaceContext.volume.valueDB); 3017 this.valueDB = Number(this.slider.value);
3018 interfaceContext.volume.valueText.textContent = interfaceContext.volume.valueDB + 'dB'; 3018 this.valueLin = decibelToLinear(this.valueDB);
3019 audioEngineContext.outputGain.gain.value = interfaceContext.volume.valueLin; 3019 this.valueText.textContent = this.valueDB + 'dB';
3020 }; 3020 audioEngineContext.outputGain.gain.value = this.valueLin;
3021 this.slider.onmouseup = function (event) { 3021 } else if (event.type == "mouseup") {
3022 this.onmouseup();
3023 }
3024 this.slider.value = this.valueDB;
3025
3026 if (event.stopPropagation) {
3027 event.stopPropagation();
3028 }
3029 }
3030 this.onmouseup = function () {
3022 var storePoint = testState.currentStore.XMLDOM.getElementsByTagName('metric')[0].getAllElementsByName('volumeTracker'); 3031 var storePoint = testState.currentStore.XMLDOM.getElementsByTagName('metric')[0].getAllElementsByName('volumeTracker');
3023 if (storePoint.length === 0) { 3032 if (storePoint.length === 0) {
3024 storePoint = storage.document.createElement('metricresult'); 3033 storePoint = storage.document.createElement('metricresult');
3025 storePoint.setAttribute('name', 'volumeTracker'); 3034 storePoint.setAttribute('name', 'volumeTracker');
3026 testState.currentStore.XMLDOM.getElementsByTagName('metric')[0].appendChild(storePoint); 3035 testState.currentStore.XMLDOM.getElementsByTagName('metric')[0].appendChild(storePoint);
3027 } else { 3036 } else {
3028 storePoint = storePoint[0]; 3037 storePoint = storePoint[0];
3029 } 3038 }
3030 var node = storage.document.createElement('movement'); 3039 var node = storage.document.createElement('movement');
3031 node.setAttribute('test-time', audioEngineContext.timer.getTestTime()); 3040 node.setAttribute('test-time', audioEngineContext.timer.getTestTime());
3032 node.setAttribute('volume', interfaceContext.volume.valueDB); 3041 node.setAttribute('volume', this.valueDB);
3033 node.setAttribute('format', 'dBFS'); 3042 node.setAttribute('format', 'dBFS');
3034 storePoint.appendChild(node); 3043 storePoint.appendChild(node);
3035 }; 3044 }
3045 this.slider.addEventListener("mousemove", this);
3046 this.root.addEventListener("mouseup", this);
3036 3047
3037 var title = document.createElement('div'); 3048 var title = document.createElement('div');
3038 title.innerHTML = '<span>Master Volume Control</span>'; 3049 title.innerHTML = '<span>Master Volume Control</span>';
3039 title.style.fontSize = '0.75em'; 3050 title.style.fontSize = '0.75em';
3040 title.style.width = "100%"; 3051 title.style.width = "100%";