OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> | 4 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> |
5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
6 <script src="resources/compatibility.js"></script> | 6 <script src="resources/compatibility.js"></script> |
7 <script src="resources/audio-testing.js"></script> | 7 <script src="resources/audio-testing.js"></script> |
| 8 <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> |
8 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 <script> | 12 <script> |
12 description("Test Interpolation for AudioParam.setValueCurveAtTime"); | 13 description("Test Interpolation for AudioParam.setValueCurveAtTime"); |
13 window.jsTestIsAsync = true; | 14 window.jsTestIsAsync = true; |
14 | 15 |
15 // Play a constant signal through a gain node that is automated using setV
alueCurveAtTime with | 16 // Play a constant signal through a gain node that is automated using setV
alueCurveAtTime with |
16 // a 2-element curve. The output should be a linear change. | 17 // a 2-element curve. The output should be a linear change. |
17 | 18 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 211 |
211 // Compute the expected result based on the config settings. | 212 // Compute the expected result based on the config settings. |
212 function computeExpectedResult(config) { | 213 function computeExpectedResult(config) { |
213 // The automation curve starts at |curveStartTime| and has duration |cu
rveDuration|. So, | 214 // The automation curve starts at |curveStartTime| and has duration |cu
rveDuration|. So, |
214 // the output should be zero until curveStartTime, linearly ramp up fro
m there to | 215 // the output should be zero until curveStartTime, linearly ramp up fro
m there to |
215 // |curveValue|, and then be constant 1 from then to the end of the buf
fer. | 216 // |curveValue|, and then be constant 1 from then to the end of the buf
fer. |
216 | 217 |
217 var expected = new Float32Array(testDurationFrames); | 218 var expected = new Float32Array(testDurationFrames); |
218 | 219 |
219 var curveStartFrame = config.curveStartTime * sampleRate; | 220 var curveStartFrame = config.curveStartTime * sampleRate; |
220 var curveEndFrame = Math.floor((config.curveStartTime + config.curveDur
ation) * sampleRate); | 221 var curveEndFrame = (config.curveStartTime + config.curveDuration) * sa
mpleRate; |
221 var fullGainFrame = config.fullGainTime * sampleRate; | 222 var fullGainFrame = config.fullGainTime * sampleRate; |
222 | 223 |
223 var k; | 224 var k; |
224 | 225 |
225 // Zero out the start. | 226 // Zero out the start. |
226 for (k = 0; k < curveStartFrame; ++k) | 227 for (k = 0; k < curveStartFrame; ++k) |
227 expected[k] = 0; | 228 expected[k] = 0; |
228 | 229 |
229 // Linearly ramp now. This assumes that the actual curve used is a lin
ear ramp, even if | 230 // Linearly ramp now. This assumes that the actual curve used is a lin
ear ramp, even if |
230 // there are many curve points. | 231 // there are many curve points. |
(...skipping 11 matching lines...) Expand all Loading... |
242 | 243 |
243 return expected; | 244 return expected; |
244 } | 245 } |
245 | 246 |
246 audit.runTasks(); | 247 audit.runTasks(); |
247 | 248 |
248 successfullyParsed = true; | 249 successfullyParsed = true; |
249 </script> | 250 </script> |
250 </body> | 251 </body> |
251 </html> | 252 </html> |
OLD | NEW |