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