Mercurial > hg > webaudioevaluationtool
comparison core.js @ 1338:6cd9c2bce083
Interfaces properly handle outside reference objects. Better core.js comment box handling. InterfaceDOM return their presented ID rather than assumed index.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 12 Jan 2016 17:10:39 +0000 |
parents | 9a99872c700f |
children | 6f41badf6416 |
comparison
equal
deleted
inserted
replaced
1337:f85abec24c58 | 1338:6cd9c2bce083 |
---|---|
1144 } | 1144 } |
1145 if (this.interfaceDOM != null) { | 1145 if (this.interfaceDOM != null) { |
1146 this.interfaceDOM.enable(); | 1146 this.interfaceDOM.enable(); |
1147 } | 1147 } |
1148 this.onplayGain = decibelToLinear(this.specification.gain)*this.buffer.buffer.playbackGain; | 1148 this.onplayGain = decibelToLinear(this.specification.gain)*this.buffer.buffer.playbackGain; |
1149 | |
1150 this.storeDOM.setAttribute('presentedId',this.id); | |
1151 this.storeDOM.setAttribute('playGain',linearToDecibel(this.onplayGain)); | 1149 this.storeDOM.setAttribute('playGain',linearToDecibel(this.onplayGain)); |
1152 }; | 1150 }; |
1153 | 1151 |
1154 this.bindInterface = function(interfaceObject) | 1152 this.bindInterface = function(interfaceObject) |
1155 { | 1153 { |
1157 this.metric.initialise(interfaceObject.getValue()); | 1155 this.metric.initialise(interfaceObject.getValue()); |
1158 if (this.state == 1) | 1156 if (this.state == 1) |
1159 { | 1157 { |
1160 this.interfaceDOM.enable(); | 1158 this.interfaceDOM.enable(); |
1161 } | 1159 } |
1160 this.storeDOM.setAttribute('presentedId',interfaceObject.getPresentedId()); | |
1162 }; | 1161 }; |
1163 | 1162 |
1164 this.loopStart = function() { | 1163 this.loopStart = function() { |
1165 this.outputGain.gain.value = this.onplayGain; | 1164 this.outputGain.gain.value = this.onplayGain; |
1166 this.metric.startListening(audioEngineContext.timer.getTestTime()); | 1165 this.metric.startListening(audioEngineContext.timer.getTestTime()); |
2541 audioObject.commentDOM = node; | 2540 audioObject.commentDOM = node; |
2542 return node; | 2541 return node; |
2543 }; | 2542 }; |
2544 | 2543 |
2545 this.sortCommentBoxes = function() { | 2544 this.sortCommentBoxes = function() { |
2546 var holder = []; | 2545 this.commentBoxes.sort(function(a,b){return a.id - b.id;}); |
2547 while (this.commentBoxes.length > 0) { | |
2548 var node = this.commentBoxes.pop(0); | |
2549 holder[node.id] = node; | |
2550 } | |
2551 this.commentBoxes = holder; | |
2552 }; | 2546 }; |
2553 | 2547 |
2554 this.showCommentBoxes = function(inject, sort) { | 2548 this.showCommentBoxes = function(inject, sort) { |
2555 if (sort) {interfaceContext.sortCommentBoxes();} | 2549 if (sort) {interfaceContext.sortCommentBoxes();} |
2556 for (var i=0; i<interfaceContext.commentBoxes.length; i++) { | 2550 for (var box of interfaceContext.commentBoxes) { |
2557 inject.appendChild(this.commentBoxes[i].trackComment); | 2551 inject.appendChild(box.trackComment); |
2558 } | 2552 } |
2559 }; | 2553 }; |
2560 | 2554 |
2561 this.deleteCommentBoxes = function() { | 2555 this.deleteCommentBoxes = function() { |
2562 this.commentBoxes = []; | 2556 this.commentBoxes = []; |