comparison ape.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
90 case 'elementFlagComments': 90 case 'elementFlagComments':
91 sessionMetrics.prototype.enableFlagComments = true; 91 sessionMetrics.prototype.enableFlagComments = true;
92 break; 92 break;
93 } 93 }
94 }); 94 });
95
96 // Create APE specific metric functions
97 audioEngineContext.metric.initialiseTest = function()
98 {
99 var sliders = document.getElementsByClassName('track-slider');
100 for (var i=0; i<sliders.length; i++)
101 {
102 audioEngineContext.audioObjects[i].metric.initialised(convSliderPosToRate(i));
103 }
104 };
105
106 audioEngineContext.metric.sliderMoveStart = function(id)
107 {
108 if (this.data == -1)
109 {
110 this.data = id;
111 } else {
112 console.log('ERROR: Metric tracker detecting two moves!');
113 this.data = -1;
114 }
115 };
116 audioEngineContext.metric.sliderMoved = function()
117 {
118 var time = audioEngineContext.timer.getTestTime();
119 var id = this.data;
120 this.data = -1;
121 var position = convSliderPosToRate(id);
122 if (audioEngineContext.timer.testStarted)
123 {
124 audioEngineContext.audioObjects[id].metric.moved(time,position);
125 }
126 };
127
128 audioEngineContext.metric.sliderPlayed = function(id)
129 {
130 var time = audioEngineContext.timer.getTestTime();
131 if (audioEngineContext.timer.testStarted)
132 {
133 if (this.lastClicked >= 0)
134 {
135 audioEngineContext.audioObjects[this.lastClicked].metric.listening(time);
136 }
137 this.lastClicked = id;
138 audioEngineContext.audioObjects[id].metric.listening(time);
139 }
140 };
95 141
96 // Create the top div for the Title element 142 // Create the top div for the Title element
97 var titleAttr = xmlSetup[0].attributes['title']; 143 var titleAttr = xmlSetup[0].attributes['title'];
98 var title = document.createElement('div'); 144 var title = document.createElement('div');
99 title.className = "title"; 145 title.className = "title";