| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test Setting of channelCountMode and channelInterpretation</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="resources/audio-testing.js"></script> |
| 8 </head> |
| 9 |
| 10 <body> |
| 11 <script> |
| 12 // Fairly arbitrary sample rate and number of frames, except the number of |
| 13 // frames should be more than a few render quantums. |
| 14 var sampleRate = 16000; |
| 15 var renderFrames = 10 * 128; |
| 16 |
| 17 var audit = Audit.createTaskRunner(); |
| 18 |
| 19 audit.defineTask("interp", function (taskDone) { |
| 20 var context = new OfflineAudioContext(1, renderFrames, sampleRate); |
| 21 var node = context.createGain(); |
| 22 |
| 23 // Set a new interpretation and verify that it changed. |
| 24 node.channelInterpretation = "discrete"; |
| 25 var value = node.channelInterpretation; |
| 26 Should("node.channelInterpretation", value).beEqualTo("discrete"); |
| 27 node.connect(context.destination); |
| 28 |
| 29 context.startRendering().then(function (buffer) { |
| 30 // After rendering, the value should have been changed. |
| 31 Should("After rendering node.channelInterpretation", |
| 32 node.channelInterpretation) |
| 33 .beEqualTo("discrete"); |
| 34 }).then(taskDone); |
| 35 }); |
| 36 |
| 37 audit.defineTask("mode", function (taskDone) { |
| 38 var context = new OfflineAudioContext(1, renderFrames, sampleRate); |
| 39 var node = context.createGain(); |
| 40 |
| 41 // Set a new mode and verify that it changed. |
| 42 node.channelCountMode = "explicit"; |
| 43 var value = node.channelCountMode; |
| 44 Should("node.channelCountMode", value).beEqualTo("explicit"); |
| 45 node.connect(context.destination); |
| 46 |
| 47 context.startRendering().then(function (buffer) { |
| 48 // After rendering, the value should have been changed. |
| 49 Should("After rendering node.channelCountMode", |
| 50 node.channelCountMode) |
| 51 .beEqualTo("explicit"); |
| 52 }).then(taskDone); |
| 53 }); |
| 54 audit.runTasks(); |
| 55 </script> |
| 56 </body> |
| 57 </html> |
| OLD | NEW |