OLD | NEW |
1 var sampleRate = 44100.0; | 1 var sampleRate = 44100.0; |
2 | 2 |
3 // How many panner nodes to create for the test. | 3 // How many panner nodes to create for the test. |
4 var nodesToCreate = 100; | 4 var nodesToCreate = 100; |
5 | 5 |
6 // Time step when each panner node starts. | 6 // Time step when each panner node starts. |
7 var timeStep = 0.001; | 7 var timeStep = 0.001; |
8 | 8 |
9 // Make sure we render long enough to get all of our nodes. | 9 // Make sure we render long enough to get all of our nodes. |
10 var renderLengthSeconds = timeStep * (nodesToCreate + 1); | 10 var renderLengthSeconds = timeStep * (nodesToCreate + 1); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 122 } |
123 | 123 |
124 function checkDistanceResult(model) { | 124 function checkDistanceResult(model) { |
125 return function(event) { | 125 return function(event) { |
126 renderedBuffer = event.renderedBuffer; | 126 renderedBuffer = event.renderedBuffer; |
127 renderedData = renderedBuffer.getChannelData(0); | 127 renderedData = renderedBuffer.getChannelData(0); |
128 | 128 |
129 // The max allowed error between the actual gain and the expected | 129 // The max allowed error between the actual gain and the expected |
130 // value. This is determined experimentally. Set to 0 to see what | 130 // value. This is determined experimentally. Set to 0 to see what |
131 // the actual errors are. | 131 // the actual errors are. |
132 var maxAllowedError = 2.3e-6; | 132 var maxAllowedError = 3.3e-6; |
133 | 133 |
134 var success = true; | 134 var success = true; |
135 | 135 |
136 // Number of impulses we found in the rendered result. | 136 // Number of impulses we found in the rendered result. |
137 var impulseCount = 0; | 137 var impulseCount = 0; |
138 | 138 |
139 // Maximum relative error in the gain of the impulses. | 139 // Maximum relative error in the gain of the impulses. |
140 var maxError = 0; | 140 var maxError = 0; |
141 | 141 |
142 // Array of locations of the impulses that were not at the | 142 // Array of locations of the impulses that were not at the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 if (success) { | 198 if (success) { |
199 testPassed("Distance test passed for distance model " + model); | 199 testPassed("Distance test passed for distance model " + model); |
200 } else { | 200 } else { |
201 testFailed("Distance test failed for distance model " + model); | 201 testFailed("Distance test failed for distance model " + model); |
202 } | 202 } |
203 | 203 |
204 finishJSTest(); | 204 finishJSTest(); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |