| 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 <title>Test Clamping of Automations</title> | 7 <title>Test Clamping of Automations</title> |
| 8 </head> | 8 </head> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 clampedSignal, { | 82 clampedSignal, { |
| 83 verbose: true, | 83 verbose: true, |
| 84 }).beCloseToArray(expectedSignal, 0); | 84 }).beCloseToArray(expectedSignal, 0); |
| 85 | 85 |
| 86 // Find the actual clamp range based on the output values. | 86 // Find the actual clamp range based on the output values. |
| 87 var actualClampStart = result.findIndex(x => x === 0); | 87 var actualClampStart = result.findIndex(x => x === 0); |
| 88 var actualClampEnd = actualClampStart + result.slice(actualClampStart)
.findIndex( | 88 var actualClampEnd = actualClampStart + result.slice(actualClampStart)
.findIndex( |
| 89 x => x != 0); | 89 x => x != 0); |
| 90 | 90 |
| 91 // Verify that the expected clamping range is a subset of the actual r
ange. | 91 // Verify that the expected clamping range is a subset of the actual r
ange. |
| 92 success = Should("Actual Clamp start (" + actualClampStart + ")", | 92 success = Should("Actual Clamp start", |
| 93 actualClampStart).beLessThanOrEqualTo(clampStartFrame) && success; | 93 actualClampStart).beLessThanOrEqualTo(clampStartFrame) && success; |
| 94 success == Should("Actual Clamp end (" + actualClampEnd + ")", | 94 success == Should("Actual Clamp end", |
| 95 actualClampEnd).beGreaterThanOrEqualTo(clampEndFrame) && success; | 95 actualClampEnd).beGreaterThanOrEqualTo(clampEndFrame) && success; |
| 96 | 96 |
| 97 if (success) | 97 if (success) |
| 98 testPassed("Clamping of BiquadFilter.frequency automation performed
correctly.") | 98 testPassed("Clamping of BiquadFilter.frequency automation performed
correctly.") |
| 99 else | 99 else |
| 100 testFailed( | 100 testFailed( |
| 101 "Clamping of BiquadFilter.frequency automation performed incorrect
ly.") | 101 "Clamping of BiquadFilter.frequency automation performed incorrect
ly.") |
| 102 | 102 |
| 103 }).then(done); | 103 }).then(done); |
| 104 }); | 104 }); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 // | 123 // |
| 124 // Then | 124 // Then |
| 125 // | 125 // |
| 126 // t = (t0 * v1 - t1 * v0 + (t1 - t0) * v) / (v1 - v0) | 126 // t = (t0 * v1 - t1 * v0 + (t1 - t0) * v) / (v1 - v0) |
| 127 // | 127 // |
| 128 return (t0 * v1 - t1 * v0 + (t1 - t0) * v) / (v1 - v0); | 128 return (t0 * v1 - t1 * v0 + (t1 - t0) * v) / (v1 - v0); |
| 129 } | 129 } |
| 130 </script> | 130 </script> |
| 131 </body> | 131 </body> |
| 132 </html> | 132 </html> |
| OLD | NEW |