comparison core.js @ 676:e604ee22185b

Updated sessionMetric bindings for APE interface
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 13 Apr 2015 11:29:25 +0100
parents 7e73d1cdcff8
children 1e736dc124ab
comparison
equal deleted inserted replaced
675:7e73d1cdcff8 676:e604ee22185b
263 if (this.testStarted == false) 263 if (this.testStarted == false)
264 { 264 {
265 this.testStartTime = audioContext.currentTime; 265 this.testStartTime = audioContext.currentTime;
266 this.testStarted = true; 266 this.testStarted = true;
267 this.updateTestTime(); 267 this.updateTestTime();
268 audioEngineContext.metric.initialiseTest();
268 } 269 }
269 }; 270 };
270 this.stopTest = function() 271 this.stopTest = function()
271 { 272 {
272 if (this.testStarted) 273 if (this.testStarted)
296 /* Used by audioEngine to link to audioObjects to minimise the timer call timers; 297 /* Used by audioEngine to link to audioObjects to minimise the timer call timers;
297 */ 298 */
298 this.engine = engine; 299 this.engine = engine;
299 this.lastClicked = -1; 300 this.lastClicked = -1;
300 this.data = -1; 301 this.data = -1;
301 302 this.initialiseTest = function(){};
302 this.initialiseTest = function()
303 {
304 var sliders = document.getElementsByClassName('track-slider');
305 for (var i=0; i<sliders.length; i++)
306 {
307 engine.audioObjects[i].metric.initialised(convSliderPosToRate(i));
308 }
309 };
310
311 this.sliderMoveStart = function(id)
312 {
313 if (this.data == -1)
314 {
315 this.data = id;
316 } else {
317 console.log('ERROR: Metric tracker detecting two moves!');
318 this.data = -1;
319 }
320 };
321 this.sliderMoved = function()
322 {
323 var time = engine.timer.getTestTime();
324 var id = this.data;
325 this.data = -1;
326 var position = convSliderPosToRate(id);
327 if (engine.timer.testStarted)
328 {
329 engine.audioObjects[id].metric.moved(time,position);
330 }
331 };
332
333 this.sliderPlayed = function(id)
334 {
335 var time = engine.timer.getTestTime();
336 if (engine.timer.testStarted)
337 {
338 if (this.lastClicked >= 0)
339 {
340 engine.audioObjects[this.lastClicked].metric.listening(time);
341 }
342 this.lastClicked = id;
343 engine.audioObjects[id].metric.listening(time);
344 }
345 };
346 } 303 }
347 304
348 function metricTracker() 305 function metricTracker()
349 { 306 {
350 /* Custom object to track and collect metric data 307 /* Custom object to track and collect metric data