Mercurial > hg > webaudioevaluationtool
comparison ape.js @ 1565:15b981237bc9
Removed selected track. audioEngineContext.play(id) now controls audioObject playbacks
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Thu, 11 Jun 2015 09:38:09 +0100 |
parents | a97e153eaecd |
children | 070a90d1117c |
comparison
equal
deleted
inserted
replaced
1564:a97e153eaecd | 1565:15b981237bc9 |
---|---|
225 | 225 |
226 var loopPlayback = audioHolderObject.loop; | 226 var loopPlayback = audioHolderObject.loop; |
227 | 227 |
228 audioEngineContext.loopPlayback = loopPlayback; | 228 audioEngineContext.loopPlayback = loopPlayback; |
229 // Create AudioEngine bindings for playback | 229 // Create AudioEngine bindings for playback |
230 if (loopPlayback) { | 230 audioEngineContext.selectedTrack = function(id) { |
231 audioEngineContext.selectedTrack = function(id) { | 231 console.log('Deprecated'); |
232 for (var i=0; i<this.audioObjects.length; i++) | 232 }; |
233 { | |
234 if (id == i) { | |
235 this.audioObjects[i].loopStart(); | |
236 } else { | |
237 this.audioObjects[i].loopStop(); | |
238 } | |
239 } | |
240 }; | |
241 } else { | |
242 audioEngineContext.selectedTrack = function(id) { | |
243 for (var i=0; i<this.audioObjects.length; i++) | |
244 { | |
245 this.audioObjects[i].outputGain.gain.value = 0.0; | |
246 this.audioObjects[i].stop(); | |
247 } | |
248 if (this.status == 1) { | |
249 this.audioObjects[id].outputGain.gain.value = 1.0; | |
250 this.audioObjects[id].play(audioContext.currentTime+0.01); | |
251 } | |
252 }; | |
253 } | |
254 | 233 |
255 currentTestHolder = document.createElement('audioHolder'); | 234 currentTestHolder = document.createElement('audioHolder'); |
256 currentTestHolder.id = audioHolderObject.id; | 235 currentTestHolder.id = audioHolderObject.id; |
257 currentTestHolder.repeatCount = audioHolderObject.repeatCount; | 236 currentTestHolder.repeatCount = audioHolderObject.repeatCount; |
258 | 237 |
325 if (audioEngineContext.audioObjectsReady) { | 304 if (audioEngineContext.audioObjectsReady) { |
326 // Cannot continue to issue play command until audioObjects reported as ready! | 305 // Cannot continue to issue play command until audioObjects reported as ready! |
327 // Get the track ID from the object ID | 306 // Get the track ID from the object ID |
328 var id = Number(event.srcElement.attributes['trackIndex'].value); | 307 var id = Number(event.srcElement.attributes['trackIndex'].value); |
329 //audioEngineContext.metric.sliderPlayed(id); | 308 //audioEngineContext.metric.sliderPlayed(id); |
330 audioEngineContext.selectedTrack(id); | 309 audioEngineContext.play(id); |
331 // Currently playing track red, rest green | 310 // Currently playing track red, rest green |
332 | 311 |
333 //document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000"; | 312 //document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000"; |
334 $('.track-slider').removeClass('track-slider-playing'); | 313 $('.track-slider').removeClass('track-slider-playing'); |
335 $(event.srcElement).addClass('track-slider-playing'); | 314 $(event.srcElement).addClass('track-slider-playing'); |