| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Automation Following setValueCurveAtTime Automations</title> | 4 <title>Test Automation Following setValueCurveAtTime Automations</title> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 8 <script src="../resources/audio-param.js"></script> | 9 <script src="../resources/audio-param.js"></script> |
| 9 </head> | 10 </head> |
| 10 | 11 |
| 11 <body> | 12 <body> |
| 12 <script> | 13 <script> |
| 13 description("Test Automation Following setValueCurveAtTime Automations"); | |
| 14 window.jsTestIsAsync = true; | |
| 15 | 14 |
| 16 var sampleRate = 12800; | 15 var sampleRate = 12800; |
| 17 // Some short duration because we don't need to run the test for very long
. | 16 // Some short duration because we don't need to run the test for very long
. |
| 18 var testDurationFrames = 256; | 17 var testDurationFrames = 256; |
| 19 var testDurationSec = testDurationFrames / sampleRate; | 18 var testDurationSec = testDurationFrames / sampleRate; |
| 20 var curveDuration = testDurationSec / 2; | 19 var curveDuration = testDurationSec / 2; |
| 21 | 20 |
| 22 var audit = Audit.createTaskRunner(); | 21 var audit = Audit.createTaskRunner(); |
| 23 | 22 |
| 24 // Configuration for each test. | 23 // Configuration for each test. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Define tests from the configs | 64 // Define tests from the configs |
| 66 for (k in testConfigs) { | 65 for (k in testConfigs) { |
| 67 audit.defineTask(k + ": " + testConfigs[k].automation, (function (config
) { | 66 audit.defineTask(k + ": " + testConfigs[k].automation, (function (config
) { |
| 68 return function (done) { | 67 return function (done) { |
| 69 runTest(config).then(done); | 68 runTest(config).then(done); |
| 70 }; | 69 }; |
| 71 })(testConfigs[k])); | 70 })(testConfigs[k])); |
| 72 } | 71 } |
| 73 | 72 |
| 74 audit.defineTask("finish", function (done) { | 73 audit.defineTask("finish", function (done) { |
| 75 finishJSTest(); | |
| 76 done(); | 74 done(); |
| 77 }); | 75 }); |
| 78 | 76 |
| 79 audit.runTasks(); | 77 audit.runTasks(); |
| 80 | 78 |
| 81 function runTest(options) { | 79 function runTest(options) { |
| 82 // For the test, use a gain node with a constant input to test the | 80 // For the test, use a gain node with a constant input to test the |
| 83 // automations. | 81 // automations. |
| 84 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate)
; | 82 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate)
; |
| 85 var source = context.createBufferSource(); | 83 var source = context.createBufferSource(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 function exponentialRampValue(t, t0, v0, t1, v1) { | 148 function exponentialRampValue(t, t0, v0, t1, v1) { |
| 151 return v0 * Math.pow(v1 / v0, (t - t0) / (t1 - t0)); | 149 return v0 * Math.pow(v1 / v0, (t - t0) / (t1 - t0)); |
| 152 } | 150 } |
| 153 | 151 |
| 154 function setTargetValue(t, t0, v0, v1, timeConstant) { | 152 function setTargetValue(t, t0, v0, v1, timeConstant) { |
| 155 return v1 + (v0 - v1) * Math.exp(-(t - t0) / timeConstant) | 153 return v1 + (v0 - v1) * Math.exp(-(t - t0) / timeConstant) |
| 156 } | 154 } |
| 157 </script> | 155 </script> |
| 158 </body> | 156 </body> |
| 159 </html> | 157 </html> |
| OLD | NEW |