| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/compatibility.js"></script> | 5 <script src="resources/compatibility.js"></script> |
| 6 <script src="resources/audio-testing.js"></script> | 6 <script src="resources/audio-testing.js"></script> |
| 7 <script src="resources/realtimeanalyser-testing.js"></script> | 7 <script src="resources/realtimeanalyser-testing.js"></script> |
| 8 <script src="resources/fft.js"></script> | 8 <script src="resources/fft.js"></script> |
| 9 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, No Smoo
thing</title> | 9 <title>Test Analyser getFloatFrequencyData and getByteFrequencyData, No Smoo
thing</title> |
| 10 </head> | 10 </head> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 basicTestsPassed = basicTestsPassed && comparison.success; | 177 basicTestsPassed = basicTestsPassed && comparison.success; |
| 178 var expected = comparison.expected; | 178 var expected = comparison.expected; |
| 179 | 179 |
| 180 // For the byte test to be better, check that there are some samples t
hat are outside the | 180 // For the byte test to be better, check that there are some samples t
hat are outside the |
| 181 // range of minDecibels and maxDecibels. If there aren't the test sho
uld update the | 181 // range of minDecibels and maxDecibels. If there aren't the test sho
uld update the |
| 182 // minDecibels and maxDecibels values for the analyser. | 182 // minDecibels and maxDecibels values for the analyser. |
| 183 | 183 |
| 184 var minValue = Math.min(...expected); | 184 var minValue = Math.min(...expected); |
| 185 var maxValue = Math.max(...expected); | 185 var maxValue = Math.max(...expected); |
| 186 | 186 |
| 187 basicTestsPassed = Should("Min FFT value", minValue) | 187 basicTestsPassed = Should("Min FFT value", minValue, { |
| 188 brief: true |
| 189 }) |
| 188 .beLessThanOrEqualTo(analyser.minDecibels) && basicTestsPassed; | 190 .beLessThanOrEqualTo(analyser.minDecibels) && basicTestsPassed; |
| 189 basicTestsPassed = Should("Max FFT value", maxValue) | 191 basicTestsPassed = Should("Max FFT value", maxValue, { |
| 192 brief: true |
| 193 }) |
| 190 .beGreaterThanOrEqualTo(analyser.maxDecibels) && basicTestsPassed; | 194 .beGreaterThanOrEqualTo(analyser.maxDecibels) && basicTestsPassed; |
| 191 | 195 |
| 192 // Test the byte frequency data. | 196 // Test the byte frequency data. |
| 193 var byteFreqData = new Uint8Array(analyser.frequencyBinCount); | 197 var byteFreqData = new Uint8Array(analyser.frequencyBinCount); |
| 194 var expectedByteData = new Float32Array(analyser.frequencyBinCount); | 198 var expectedByteData = new Float32Array(analyser.frequencyBinCount); |
| 195 analyser.getByteFrequencyData(byteFreqData); | 199 analyser.getByteFrequencyData(byteFreqData); |
| 196 | 200 |
| 197 // Convert the expected float frequency data to byte data. | 201 // Convert the expected float frequency data to byte data. |
| 198 var expectedByteData = convertFloatToByte(expected, analyser.minDecibe
ls, | 202 var expectedByteData = convertFloatToByte(expected, analyser.minDecibe
ls, |
| 199 analyser.maxDecibels); | 203 analyser.maxDecibels); |
| 200 | 204 |
| 201 basicTestsPassed = Should(analyser.fftSize + "-point byte FFT", byteFr
eqData, { | 205 basicTestsPassed = Should(analyser.fftSize + "-point byte FFT", byteFr
eqData) |
| 202 verbose: true | 206 .beCloseToArray(expectedByteData, 0) && basicTestsPassed; |
| 203 }).beCloseToArray(expectedByteData, 0) && basicTestsPassed; | |
| 204 | 207 |
| 205 }).then(context.resume.bind(context)); | 208 }).then(context.resume.bind(context)); |
| 206 | 209 |
| 207 return context.startRendering(); | 210 return context.startRendering(); |
| 208 } | 211 } |
| 209 </script> | 212 </script> |
| 210 </body> | 213 </body> |
| 211 </html> | 214 </html> |
| OLD | NEW |