Mercurial > hg > webaudioevaluationtool
comparison core.js @ 1086:f9c9a40f33bd
Merge. Pull of revision info from dev_main.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Wed, 23 Dec 2015 14:36:00 +0000 |
parents | 56ee920d5d85 888292c88c33 |
children | 8bf6395cefc1 |
comparison
equal
deleted
inserted
replaced
812:75786c989073 | 1086:f9c9a40f33bd |
---|---|
14 var testState; | 14 var testState; |
15 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order | 15 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order |
16 var audioEngineContext; // The custome AudioEngine object | 16 var audioEngineContext; // The custome AudioEngine object |
17 var projectReturn; // Hold the URL for the return | 17 var projectReturn; // Hold the URL for the return |
18 | 18 |
19 | |
20 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it | |
21 AudioBufferSourceNode.prototype.owner = undefined; | |
22 // Add a prototype to the bufferNode to hold the desired LINEAR gain | |
23 AudioBuffer.prototype.gain = undefined; | |
24 // Add a prototype to the bufferNode to hold the computed LUFS loudness | |
25 AudioBuffer.prototype.lufs = undefined; | |
26 | |
27 window.onload = function() { | 19 window.onload = function() { |
28 // Function called once the browser has loaded all files. | 20 // Function called once the browser has loaded all files. |
29 // This should perform any initial commands such as structure / loading documents | 21 // This should perform any initial commands such as structure / loading documents |
30 | 22 |
31 // Create a web audio API context | 23 // Create a web audio API context |
44 | 36 |
45 // Create the interface object | 37 // Create the interface object |
46 interfaceContext = new Interface(specification); | 38 interfaceContext = new Interface(specification); |
47 // Define window callbacks for interface | 39 // Define window callbacks for interface |
48 window.onresize = function(event){interfaceContext.resizeWindow(event);}; | 40 window.onresize = function(event){interfaceContext.resizeWindow(event);}; |
41 | |
42 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it | |
43 AudioBufferSourceNode.prototype.owner = undefined; | |
44 // Add a prototype to the bufferNode to hold the desired LINEAR gain | |
45 AudioBuffer.prototype.gain = 1.0; | |
46 // Add a prototype to the bufferNode to hold the computed LUFS loudness | |
47 AudioBuffer.prototype.lufs = -23; | |
49 }; | 48 }; |
50 | 49 |
51 function loadProjectSpec(url) { | 50 function loadProjectSpec(url) { |
52 // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data | 51 // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data |
53 // If url is null, request client to upload project XML document | 52 // If url is null, request client to upload project XML document |
811 if (bufferObj.users[i].interfaceDOM != null) | 810 if (bufferObj.users[i].interfaceDOM != null) |
812 { | 811 { |
813 bufferObj.users[i].bufferLoaded(bufferObj); | 812 bufferObj.users[i].bufferLoaded(bufferObj); |
814 } | 813 } |
815 } | 814 } |
816 calculateLoudness(bufferObj.buffer,"I"); | 815 //calculateLoudness(bufferObj.buffer,"I"); |
817 }, function(){ | 816 }, function(){ |
818 // Should only be called if there was an error, but sometimes gets called continuously | 817 // Should only be called if there was an error, but sometimes gets called continuously |
819 // Check here if the error is genuine | 818 // Check here if the error is genuine |
820 if (bufferObj.buffer == undefined) { | 819 if (bufferObj.buffer == undefined) { |
821 // Genuine error | 820 // Genuine error |
1062 this.buffer = callee; | 1061 this.buffer = callee; |
1063 } | 1062 } |
1064 this.state = 1; | 1063 this.state = 1; |
1065 this.buffer.buffer.gain = callee.buffer.gain; | 1064 this.buffer.buffer.gain = callee.buffer.gain; |
1066 this.buffer.buffer.lufs = callee.buffer.lufs; | 1065 this.buffer.buffer.lufs = callee.buffer.lufs; |
1066 /* | |
1067 var targetLUFS = this.specification.parent.loudness; | 1067 var targetLUFS = this.specification.parent.loudness; |
1068 if (typeof targetLUFS === "number") | 1068 if (typeof targetLUFS === "number") |
1069 { | 1069 { |
1070 this.buffer.buffer.gain = decibelToLinear(targetLUFS - this.buffer.buffer.lufs); | 1070 this.buffer.buffer.gain = decibelToLinear(targetLUFS - this.buffer.buffer.lufs); |
1071 } else { | 1071 } else { |
1072 this.buffer.buffer.gain = 1.0; | 1072 this.buffer.buffer.gain = 1.0; |
1073 } | 1073 } |
1074 */ | |
1074 if (this.interfaceDOM != null) { | 1075 if (this.interfaceDOM != null) { |
1075 this.interfaceDOM.enable(); | 1076 this.interfaceDOM.enable(); |
1076 } | 1077 } |
1077 }; | 1078 }; |
1078 | 1079 |