| 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/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 6 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audio-testing.js"></script> |
| 7 <script src="../resources/panner-formulas.js"></script> | 8 <script src="../resources/panner-formulas.js"></script> |
| 8 <title>Test Basic PannerNode with Automation Position Properties</title> | 9 <title>Test Basic PannerNode with Automation Position Properties</title> |
| 9 </head> | 10 </head> |
| 10 | 11 |
| 11 <body> | 12 <body> |
| 12 <script> | 13 <script> |
| 13 description("Test Basic PannerNode with Automation Position Properties."); | |
| 14 window.jsTestIsAsync = true; | |
| 15 | |
| 16 var sampleRate = 48000; | 14 var sampleRate = 48000; |
| 17 | 15 |
| 18 // These tests are quite slow, so don't run for many frames. 256 frames s
hould be enough to | 16 // These tests are quite slow, so don't run for many frames. 256 frames s
hould be enough to |
| 19 // demonstrate that automations are working. | 17 // demonstrate that automations are working. |
| 20 var renderFrames = 256; | 18 var renderFrames = 256; |
| 21 var renderDuration = renderFrames / sampleRate; | 19 var renderDuration = renderFrames / sampleRate; |
| 22 | 20 |
| 23 var audit = Audit.createTaskRunner(); | 21 var audit = Audit.createTaskRunner(); |
| 24 | 22 |
| 25 // Array of tests for setting the panner positions. These tests basically
verify that the | 23 // Array of tests for setting the panner positions. These tests basically
verify that the |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 context.listener.upX.value = 100; | 165 context.listener.upX.value = 100; |
| 168 context.listener.upY.value = 100; | 166 context.listener.upY.value = 100; |
| 169 context.listener.upZ.value = 100;; | 167 context.listener.upZ.value = 100;; |
| 170 }).then(context.resume.bind(context)); | 168 }).then(context.resume.bind(context)); |
| 171 | 169 |
| 172 context.startRendering().then(function (resultBuffer) { | 170 context.startRendering().then(function (resultBuffer) { |
| 173 verifyPannerOutputChanged(resultBuffer, {message: "listener.up{XYZ}",
suspendFrame: suspendFrame}); | 171 verifyPannerOutputChanged(resultBuffer, {message: "listener.up{XYZ}",
suspendFrame: suspendFrame}); |
| 174 }).then(done); | 172 }).then(done); |
| 175 }); | 173 }); |
| 176 | 174 |
| 177 audit.defineTask("finish", function (done) { | |
| 178 finishJSTest(); | |
| 179 done(); | |
| 180 }); | |
| 181 | |
| 182 audit.runTasks(); | 175 audit.runTasks(); |
| 183 | 176 |
| 184 function createGraph(channelCount) { | 177 function createGraph(channelCount) { |
| 185 var context = new OfflineAudioContext(2, renderFrames, sampleRate); | 178 var context = new OfflineAudioContext(2, renderFrames, sampleRate); |
| 186 var panner = context.createPanner(); | 179 var panner = context.createPanner(); |
| 187 var source = context.createBufferSource(); | 180 var source = context.createBufferSource(); |
| 188 source.buffer = createConstantBuffer(context, 1, channelCount == 1 ? 1 :
[1, 2]); | 181 source.buffer = createConstantBuffer(context, 1, channelCount == 1 ? 1 :
[1, 2]); |
| 189 source.loop = true; | 182 source.loop = true; |
| 190 | 183 |
| 191 source.connect(panner); | 184 source.connect(panner); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 .beConstantValueOf(data0[suspendFrame]) && success; | 231 .beConstantValueOf(data0[suspendFrame]) && success; |
| 239 success = Should(message + ".value frame " + middle + "channel 0", | 232 success = Should(message + ".value frame " + middle + "channel 0", |
| 240 data1.slice(suspendFrame)) | 233 data1.slice(suspendFrame)) |
| 241 .beConstantValueOf(data1[suspendFrame]) && success; | 234 .beConstantValueOf(data1[suspendFrame]) && success; |
| 242 success = Should("Output at frame " + suspendFrame + " channel 0", dat
a0[suspendFrame]) | 235 success = Should("Output at frame " + suspendFrame + " channel 0", dat
a0[suspendFrame]) |
| 243 .notBeEqualTo(data0[0]) && success; | 236 .notBeEqualTo(data0[0]) && success; |
| 244 success = Should("Output at frame " + suspendFrame + " channel 1", dat
a1[suspendFrame]) | 237 success = Should("Output at frame " + suspendFrame + " channel 1", dat
a1[suspendFrame]) |
| 245 .notBeEqualTo(data1[0]) && success; | 238 .notBeEqualTo(data1[0]) && success; |
| 246 | 239 |
| 247 var prefix = "Directly setting " + message + ".value"; | 240 var prefix = "Directly setting " + message + ".value"; |
| 248 if (success) | 241 Should(prefix, success) |
| 249 testPassed(prefix + " worked.\n"); | 242 .summarize("worked", "failed"); |
| 250 else | |
| 251 testFailed(prefix + " failed.\n"); | |
| 252 } | 243 } |
| 253 </script> | 244 </script> |
| 254 </body> | 245 </body> |
| 255 </html> | 246 </html> |
| OLD | NEW |