Mercurial > hg > webaudioevaluationtool
comparison mushra.js @ 756:46acb0963059
MUSHRA fixes. Added some mushra features to match newer APE interfaces and core bindings.
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Thu, 17 Dec 2015 13:34:23 +0000 |
parents | c73996a0fb21 |
children | 8512c2dbac19 |
comparison
equal
deleted
inserted
replaced
755:c73996a0fb21 | 756:46acb0963059 |
---|---|
97 { | 97 { |
98 var id = audioHolderObject.id; | 98 var id = audioHolderObject.id; |
99 | 99 |
100 var feedbackHolder = document.getElementById('feedbackHolder'); | 100 var feedbackHolder = document.getElementById('feedbackHolder'); |
101 var interfaceObj = audioHolderObject.interfaces; | 101 var interfaceObj = audioHolderObject.interfaces; |
102 if (interfaceObj.length > 1) | |
103 { | |
104 console.log("WARNING - This interface only supports one <interface> node per page. Using first interface node"); | |
105 } | |
102 | 106 |
103 var sliderBox = document.getElementById('slider'); | 107 var sliderBox = document.getElementById('slider'); |
104 feedbackHolder.innerHTML = null; | 108 feedbackHolder.innerHTML = null; |
105 sliderBox.innerHTML = null; | 109 sliderBox.innerHTML = null; |
106 | 110 |
169 this.title.textContent = audioObject.id; | 173 this.title.textContent = audioObject.id; |
170 this.title.style.width = "100%"; | 174 this.title.style.width = "100%"; |
171 this.title.style.float = "left"; | 175 this.title.style.float = "left"; |
172 | 176 |
173 this.slider.type = "range"; | 177 this.slider.type = "range"; |
178 this.slider.className = "track-slider-range"; | |
174 this.slider.min = "0"; | 179 this.slider.min = "0"; |
175 this.slider.max = "1"; | 180 this.slider.max = "1"; |
176 this.slider.step = "0.01"; | 181 this.slider.step = "0.01"; |
177 this.slider.setAttribute('orient','vertical'); | 182 this.slider.setAttribute('orient','vertical'); |
178 this.slider.style.float = "left"; | |
179 this.slider.style.width = "100%"; | |
180 this.slider.style.height = window.innerHeight-250 + 'px'; | 183 this.slider.style.height = window.innerHeight-250 + 'px'; |
181 this.slider.onchange = function() | 184 this.slider.onchange = function() |
182 { | 185 { |
183 var time = audioEngineContext.timer.getTestTime(); | 186 var time = audioEngineContext.timer.getTestTime(); |
184 var id = Number(this.parentNode.getAttribute('trackIndex')); | 187 var id = Number(this.parentNode.getAttribute('trackIndex')); |
188 | 191 |
189 this.play.textContent = "Play"; | 192 this.play.textContent = "Play"; |
190 this.play.value = audioObject.id; | 193 this.play.value = audioObject.id; |
191 this.play.style.float = "left"; | 194 this.play.style.float = "left"; |
192 this.play.style.width = "100%"; | 195 this.play.style.width = "100%"; |
193 this.play.onclick = function() | 196 this.play.disabled = true; |
194 { | 197 this.play.onclick = function(event) |
195 audioEngineContext.play(); | 198 { |
196 if (audioEngineContext.audioObjectsReady) { | 199 var id = Number(event.srcElement.value); |
197 var id = Number(event.srcElement.value); | 200 //audioEngineContext.metric.sliderPlayed(id); |
198 //audioEngineContext.metric.sliderPlayed(id); | 201 audioEngineContext.play(id); |
199 audioEngineContext.play(id); | 202 $(".track-slider").removeClass('track-slider-playing'); |
200 } | 203 $(event.currentTarget.parentElement).addClass('track-slider-playing'); |
201 }; | 204 }; |
202 | 205 |
203 this.enable = function() { | 206 this.enable = function() { |
204 if (this.parent.state == 1) | 207 this.play.disabled = false; |
205 { | 208 $(this.slider).removeClass('track-slider-disabled'); |
206 $(this.slider).removeClass('track-slider-disabled'); | |
207 } | |
208 }; | 209 }; |
209 | 210 |
210 this.exportXMLDOM = function(audioObject) { | 211 this.exportXMLDOM = function(audioObject) { |
211 // Called by the audioObject holding this element. Must be present | 212 // Called by the audioObject holding this element. Must be present |
212 var node = document.createElement('value'); | 213 var node = document.createElement('value'); |
214 return node; | 215 return node; |
215 }; | 216 }; |
216 this.getValue = function() { | 217 this.getValue = function() { |
217 return this.slider.value; | 218 return this.slider.value; |
218 }; | 219 }; |
220 | |
221 if (this.parent.state == 1) | |
222 { | |
223 this.enable(); | |
224 } | |
219 } | 225 } |
220 | 226 |
221 | 227 |
222 function buttonSubmitClick() // TODO: Only when all songs have been played! | 228 function buttonSubmitClick() // TODO: Only when all songs have been played! |
223 { | 229 { |