Mercurial > hg > webaudioevaluationtool
comparison test_create/test_create.html @ 402:db353cc479b8 Dev_main
test create has gain controllers on each item
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Fri, 11 Dec 2015 18:32:32 +0000 |
parents | 17a2b99622c0 |
children | 9a8ede168aba |
comparison
equal
deleted
inserted
replaced
401:17a2b99622c0 | 402:db353cc479b8 |
---|---|
2779 audioElems.id = aHTML.id+"-audioElements"; | 2779 audioElems.id = aHTML.id+"-audioElements"; |
2780 audioElems.className = "SecondLevel"; | 2780 audioElems.className = "SecondLevel"; |
2781 var title = document.createElement("h3"); | 2781 var title = document.createElement("h3"); |
2782 title.textContent = "Audio Elements"; | 2782 title.textContent = "Audio Elements"; |
2783 audioElems.appendChild(title); | 2783 audioElems.appendChild(title); |
2784 for (var i=0; i<aH.audioElements.length; i++) | 2784 for (var j=0; j<aH.audioElements.length; j++) |
2785 { | 2785 { |
2786 var entry = document.createElement("div"); | 2786 var entry = document.createElement("div"); |
2787 entry.className = "SecondLevel"; | 2787 entry.className = "SecondLevel"; |
2788 entry.id = audioElems.id+"-"+aH.audioElements[i].id; | 2788 entry.id = audioElems.id+"-"+aH.audioElements[j].id; |
2789 var text = document.createElement("span"); | 2789 var text = document.createElement("span"); |
2790 text.textContent = "ID:"; | 2790 text.textContent = "ID:"; |
2791 var input = document.createElement("input"); | 2791 var input = document.createElement("input"); |
2792 input.id = entry.id+"-id"; | 2792 input.id = entry.id+"-id"; |
2793 input.value = aH.audioElements[i].id; | 2793 input.value = aH.audioElements[j].id; |
2794 input.onchange = function() { | 2794 input.onchange = function() { |
2795 var IDSplit = event.currentTarget.id.split("-"); | 2795 var IDSplit = event.currentTarget.id.split("-"); |
2796 var ahNode = specificationNode.audioHolders[IDSplit[1]]; | 2796 var ahNode = specificationNode.audioHolders[IDSplit[1]]; |
2797 ahNode.audioElements[IDSplit[3]].id = event.currentTarget.value; | 2797 ahNode.audioElements[IDSplit[3]].id = event.currentTarget.value; |
2798 }; | 2798 }; |
2802 entry.appendChild(input); | 2802 entry.appendChild(input); |
2803 text = document.createElement("span"); | 2803 text = document.createElement("span"); |
2804 text.textContent = "URL:"; | 2804 text.textContent = "URL:"; |
2805 input = document.createElement("input"); | 2805 input = document.createElement("input"); |
2806 input.id = entry.id+"-URL"; | 2806 input.id = entry.id+"-URL"; |
2807 input.value = aH.audioElements[i].url; | 2807 input.value = aH.audioElements[j].url; |
2808 input.onchange = function() { | 2808 input.onchange = function() { |
2809 var IDSplit = event.currentTarget.id.split("-"); | 2809 var IDSplit = event.currentTarget.id.split("-"); |
2810 var ahNode = specificationNode.audioHolders[IDSplit[1]]; | 2810 var ahNode = specificationNode.audioHolders[IDSplit[1]]; |
2811 ahNode.audioElements[IDSplit[3]].url = event.currentTarget.value; | 2811 ahNode.audioElements[IDSplit[3]].url = event.currentTarget.value; |
2812 }; | 2812 }; |
2813 text.style.margin = "5px"; | 2813 text.style.margin = "5px"; |
2814 input.style.margin = "5px"; | 2814 input.style.margin = "5px"; |
2815 entry.appendChild(text); | 2815 entry.appendChild(text); |
2816 entry.appendChild(input); | 2816 entry.appendChild(input); |
2817 text = document.createElement("span"); | |
2818 text.textContent = "Gain:"; | |
2819 input = document.createElement("input"); | |
2820 input.type = "range"; | |
2821 input.id = entry.id+"-gain"; | |
2822 input.value = aH.audioElements[j].gain; | |
2823 input.min = -25; | |
2824 input.max = 6; | |
2825 input.step = 1; | |
2826 input.onchange = function() { | |
2827 var IDSplit = event.currentTarget.id.split("-"); | |
2828 var ahNode = specificationNode.audioHolders[IDSplit[1]]; | |
2829 ahNode.audioElements[IDSplit[3]].gain = decibelToLinear(Number(event.currentTarget.value)); | |
2830 var textRet = document.getElementById(event.currentTarget.id+"-ret"); | |
2831 textRet.textContent = String(event.currentTarget.value)+"dB"; | |
2832 }; | |
2833 var textRet = document.createElement("span"); | |
2834 textRet.textContent = String(linearToDecibel(aH.audioElements[j].gain))+"dB"; | |
2835 textRet.id = entry.id+"-gain-ret"; | |
2836 text.style.margin = "5px"; | |
2837 input.style.margin = "5px"; | |
2838 entry.appendChild(text); | |
2839 entry.appendChild(input); | |
2840 entry.appendChild(textRet); | |
2817 var button_delete = document.createElement("button"); | 2841 var button_delete = document.createElement("button"); |
2818 button_delete.textContent = "Delete"; | 2842 button_delete.textContent = "Delete"; |
2819 button_delete.onclick = function() { | 2843 button_delete.onclick = function() { |
2820 var node = event.currentTarget.parentElement; | 2844 var node = event.currentTarget.parentElement; |
2821 var IDSplit = node.id.split("-"); | 2845 var IDSplit = node.id.split("-"); |