| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Clamping of AudioParam Time</title> | 4 <title>Test Clamping of AudioParam Time</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 method: "setValueAtTime", | 23 method: "setValueAtTime", |
| 24 initialGain: 0, | 24 initialGain: 0, |
| 25 arg0: 1, | 25 arg0: 1, |
| 26 }) | 26 }) |
| 27 .then(function (resultBuffer) { | 27 .then(function (resultBuffer) { |
| 28 // Just verify that the cosine wave actually started at | 28 // Just verify that the cosine wave actually started at |
| 29 // suspendFrame. | 29 // suspendFrame. |
| 30 var result = resultBuffer.getChannelData(0); | 30 var result = resultBuffer.getChannelData(0); |
| 31 var success = true; | 31 var success = true; |
| 32 | 32 |
| 33 success = Should("Output[0-" + (suspendFrame - 1) + "]", | 33 success = Should("setValue: Output[0-" + (suspendFrame - 1) + "]", |
| 34 result.slice(0, suspendFrame)) | 34 result.slice(0, suspendFrame)) |
| 35 .beConstantValueOf(0) && success; | 35 .beConstantValueOf(0) && success; |
| 36 success = Should("Output[" + suspendFrame + "-" + ( | 36 success = Should("setValue: Output[" + suspendFrame + "-" + ( |
| 37 renderFrames - 1) + "]", | 37 renderFrames - 1) + "]", |
| 38 result.slice(suspendFrame)) | 38 result.slice(suspendFrame)) |
| 39 .beConstantValueOf(1) && success; | 39 .beConstantValueOf(1) && success; |
| 40 | 40 |
| 41 Should("*** setValueAtTime in the past", success) | 41 Should("*** setValueAtTime in the past", success) |
| 42 .summarize( | 42 .summarize( |
| 43 "correctly clamped to current time", | 43 "correctly clamped to current time", |
| 44 "was not correctly clamped to current time"); | 44 "was not correctly clamped to current time"); |
| 45 }) | 45 }) |
| 46 .then(taskDone); | 46 .then(taskDone); |
| 47 }); | 47 }); |
| 48 | 48 |
| 49 audit.defineTask("linear", function (taskDone) { | 49 audit.defineTask("linear", function (taskDone) { |
| 50 var suspendFrame = 128; | 50 var suspendFrame = 128; |
| 51 createGraph({ | 51 createGraph({ |
| 52 suspendFrame: suspendFrame, | 52 suspendFrame: suspendFrame, |
| 53 method: "linearRampToValueAtTime", | 53 method: "linearRampToValueAtTime", |
| 54 initialGain: 1, | 54 initialGain: 1, |
| 55 arg0: 0.5 | 55 arg0: 0.5 |
| 56 }) | 56 }) |
| 57 .then(function (resultBuffer) { | 57 .then(function (resultBuffer) { |
| 58 // Just verify that the cosine wave actually started at | 58 // Just verify that the cosine wave actually started at |
| 59 // suspendFrame. | 59 // suspendFrame. |
| 60 var result = resultBuffer.getChannelData(0); | 60 var result = resultBuffer.getChannelData(0); |
| 61 var success = true; | 61 var success = true; |
| 62 | 62 |
| 63 success = Should("Output[0-" + (suspendFrame - 1) + "]", | 63 success = Should("linear: Output[0-" + (suspendFrame - 1) + "]", |
| 64 result.slice(0, suspendFrame)) | 64 result.slice(0, suspendFrame)) |
| 65 .beConstantValueOf(1) && success; | 65 .beConstantValueOf(1) && success; |
| 66 success = Should("Output[" + suspendFrame + "-" + ( | 66 success = Should("linear: Output[" + suspendFrame + "-" + ( |
| 67 renderFrames - 1) + "]", | 67 renderFrames - 1) + "]", |
| 68 result.slice(suspendFrame)) | 68 result.slice(suspendFrame)) |
| 69 .beConstantValueOf(0.5) && success; | 69 .beConstantValueOf(0.5) && success; |
| 70 | 70 |
| 71 Should("*** linearRampToValueAtTime in the past", success) | 71 Should("*** linearRampToValueAtTime in the past", success) |
| 72 .summarize( | 72 .summarize( |
| 73 "correctly clamped to current time", | 73 "correctly clamped to current time", |
| 74 "was not correctly clamped to current time"); | 74 "was not correctly clamped to current time"); |
| 75 }) | 75 }) |
| 76 .then(taskDone); | 76 .then(taskDone); |
| 77 }); | 77 }); |
| 78 | 78 |
| 79 audit.defineTask("exponential", function (taskDone) { | 79 audit.defineTask("exponential", function (taskDone) { |
| 80 var suspendFrame = 128; | 80 var suspendFrame = 128; |
| 81 createGraph({ | 81 createGraph({ |
| 82 suspendFrame: suspendFrame, | 82 suspendFrame: suspendFrame, |
| 83 method: "exponentialRampToValueAtTime", | 83 method: "exponentialRampToValueAtTime", |
| 84 initialGain: 1, | 84 initialGain: 1, |
| 85 arg0: 0.5 | 85 arg0: 0.5 |
| 86 }) | 86 }) |
| 87 .then(function (resultBuffer) { | 87 .then(function (resultBuffer) { |
| 88 // Just verify that the cosine wave actually started at | 88 // Just verify that the cosine wave actually started at |
| 89 // suspendFrame. | 89 // suspendFrame. |
| 90 var result = resultBuffer.getChannelData(0); | 90 var result = resultBuffer.getChannelData(0); |
| 91 var success = true; | 91 var success = true; |
| 92 | 92 |
| 93 success = Should("Output[0-" + (suspendFrame - 1) + "]", | 93 success = Should("exponential: Output[0-" + (suspendFrame - 1) + "]"
, |
| 94 result.slice(0, suspendFrame)) | 94 result.slice(0, suspendFrame)) |
| 95 .beConstantValueOf(1) && success; | 95 .beConstantValueOf(1) && success; |
| 96 success = Should("Output[" + suspendFrame + "-" + ( | 96 success = Should("exponential: Output[" + suspendFrame + "-" + ( |
| 97 renderFrames - 1) + "]", | 97 renderFrames - 1) + "]", |
| 98 result.slice(suspendFrame)) | 98 result.slice(suspendFrame)) |
| 99 .beConstantValueOf(0.5) && success; | 99 .beConstantValueOf(0.5) && success; |
| 100 | 100 |
| 101 Should("*** exponentialRampToValueAtTime in the past", | 101 Should("*** exponentialRampToValueAtTime in the past", |
| 102 success) | 102 success) |
| 103 .summarize( | 103 .summarize( |
| 104 "correctly clamped to current time", | 104 "correctly clamped to current time", |
| 105 "was not correctly clamped to current time"); | 105 "was not correctly clamped to current time"); |
| 106 }) | 106 }) |
| 107 .then(taskDone); | 107 .then(taskDone); |
| 108 }); | 108 }); |
| 109 | 109 |
| 110 audit.defineTask("setTarget", function (taskDone) { | 110 audit.defineTask("setTarget", function (taskDone) { |
| 111 var suspendFrame = 128; | 111 var suspendFrame = 128; |
| 112 createGraph({ | 112 createGraph({ |
| 113 suspendFrame: suspendFrame, | 113 suspendFrame: suspendFrame, |
| 114 method: "setTargetAtTime", | 114 method: "setTargetAtTime", |
| 115 initialGain: 1, | 115 initialGain: 1, |
| 116 arg0: 0.5, | 116 arg0: 0.5, |
| 117 moreArgs: 0.1 | 117 moreArgs: 0.1 |
| 118 }) | 118 }) |
| 119 .then(function (resultBuffer) { | 119 .then(function (resultBuffer) { |
| 120 // Just verify that the cosine wave actually started at | 120 // Just verify that the cosine wave actually started at |
| 121 // suspendFrame. | 121 // suspendFrame. |
| 122 var result = resultBuffer.getChannelData(0); | 122 var result = resultBuffer.getChannelData(0); |
| 123 var success = true; | 123 var success = true; |
| 124 | 124 |
| 125 success = Should("Output[0-" + (suspendFrame - 1) + "]", | 125 success = Should("setTarget: Output[0-" + (suspendFrame - 1) + "]", |
| 126 result.slice(0, suspendFrame)) | 126 result.slice(0, suspendFrame)) |
| 127 .beConstantValueOf(1) && success; | 127 .beConstantValueOf(1) && success; |
| 128 // For the samples past the suspend time, we only care that first | 128 // For the samples past the suspend time, we only care that first |
| 129 // value is 1 and that the rest are not zero. | 129 // value is 1 and that the rest are not zero. |
| 130 success = Should("Output[" + suspendFrame + "]", | 130 success = Should("setTarget: Output[" + suspendFrame + "]", |
| 131 result[suspendFrame]).beEqualTo(1) && success; | 131 result[suspendFrame]).beEqualTo(1) && success; |
| 132 | 132 |
| 133 var positive = result.slice(suspendFrame + 1).every(x => x > | 133 var positive = result.slice(suspendFrame + 1).every(x => x > |
| 134 0); | 134 0); |
| 135 success = Should("Output[" + (suspendFrame + 1) + "-" + | 135 success = Should("Output[" + (suspendFrame + 1) + "-" + |
| 136 (renderFrames - 1) + "] contains only positive values", | 136 (renderFrames - 1) + "] contains only positive values", |
| 137 positive) | 137 positive) |
| 138 .beEqualTo(true) && success; | 138 .beEqualTo(true) && success; |
| 139 | 139 |
| 140 Should("*** setTargetAtTime in the past", success) | 140 Should("*** setTargetAtTime in the past", success) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 initialGain: 1, | 153 initialGain: 1, |
| 154 arg0: Float32Array.from([2, 3]), | 154 arg0: Float32Array.from([2, 3]), |
| 155 moreArgs: 0.1 | 155 moreArgs: 0.1 |
| 156 }) | 156 }) |
| 157 .then(function (resultBuffer) { | 157 .then(function (resultBuffer) { |
| 158 // Just verify that the cosine wave actually started at | 158 // Just verify that the cosine wave actually started at |
| 159 // suspendFrame. | 159 // suspendFrame. |
| 160 var result = resultBuffer.getChannelData(0); | 160 var result = resultBuffer.getChannelData(0); |
| 161 var success = true; | 161 var success = true; |
| 162 | 162 |
| 163 success = Should("Output[0-" + (suspendFrame - 1) + "]", | 163 success = Should("setValueCurve: Output[0-" + (suspendFrame - 1) + "
]", |
| 164 result.slice(0, suspendFrame)) | 164 result.slice(0, suspendFrame)) |
| 165 .beConstantValueOf(1) && success; | 165 .beConstantValueOf(1) && success; |
| 166 | 166 |
| 167 // The selected curve contains values greater than or equal to 2. | 167 // The selected curve contains values greater than or equal to 2. |
| 168 // Just verify that all values are greater than or equal to 2. | 168 // Just verify that all values are greater than or equal to 2. |
| 169 var biggerThan2 = result.slice(suspendFrame).every(x => x >= | 169 var biggerThan2 = result.slice(suspendFrame).every(x => x >= |
| 170 2); | 170 2); |
| 171 success = Should("Output[" + suspendFrame + "-" + ( | 171 success = Should("setValueCurve: Output[" + suspendFrame + "-" + ( |
| 172 renderFrames - 1) + "]", | 172 renderFrames - 1) + "]", |
| 173 biggerThan2) | 173 biggerThan2) |
| 174 .beEqualTo(true) && success; | 174 .beEqualTo(true) && success; |
| 175 | 175 |
| 176 Should("*** setValueCurveAtTime in the past", success) | 176 Should("*** setValueCurveAtTime in the past", success) |
| 177 .summarize( | 177 .summarize( |
| 178 "correctly clamped to current time", | 178 "correctly clamped to current time", |
| 179 "was not correctly clamped to current time"); | 179 "was not correctly clamped to current time"); |
| 180 }) | 180 }) |
| 181 .then(taskDone); | 181 .then(taskDone); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // rendering. | 229 // rendering. |
| 230 src.start(); | 230 src.start(); |
| 231 | 231 |
| 232 return context.startRendering(); | 232 return context.startRendering(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 audit.runTasks(); | 235 audit.runTasks(); |
| 236 </script> | 236 </script> |
| 237 </body> | 237 </body> |
| 238 </html> | 238 </html> |
| OLD | NEW |