OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 | 3 <head> |
4 <head> | 4 <title> |
5 <script src="../../resources/testharness.js"></script> | 5 audiochannelmerger-input-non-default.html |
6 <script src="../../resources/testharnessreport.js"></script> | 6 </title> |
7 <script src="../resources/audit-util.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
8 <script src="../resources/audit.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
9 <script src="../resources/merger-testing.js"></script> | 9 <script src="../resources/audit-util.js"></script> |
10 </head> | 10 <script src="../resources/audit.js"></script> |
11 | 11 <script src="../resources/merger-testing.js"></script> |
12 <body> | 12 </head> |
13 <script> | 13 <body> |
14 | 14 <script id="layout-test-code"> |
15 var audit = Audit.createTaskRunner(); | 15 let audit = Audit.createTaskRunner(); |
16 | 16 |
17 | 17 |
18 // Task: Check if an inactive input renders a silent mono channel in the | 18 // Task: Check if an inactive input renders a silent mono channel in the |
19 // output. | 19 // output. |
20 audit.define('silent-channel', (task, should) => { | 20 audit.define('silent-channel', (task, should) => { |
21 testMergerInput(should, { | 21 testMergerInput(should, { |
22 numberOfChannels: 7, | 22 numberOfChannels: 7, |
23 | 23 |
24 // Create a mono source buffer filled with '1'. | 24 // Create a mono source buffer filled with '1'. |
25 testBufferContent: [1], | 25 testBufferContent: [1], |
26 | 26 |
27 // Connect the output of source into the 7th input of merger. | 27 // Connect the output of source into the 7th input of merger. |
28 mergerInputIndex: 6, | 28 mergerInputIndex: 6, |
29 | 29 |
30 // 7th channel should be '1'. | 30 // 7th channel should be '1'. |
31 expected: [0, 0, 0, 0, 0, 0, 1], | 31 expected: [0, 0, 0, 0, 0, 0, 1], |
32 }) | 32 }).then(() => task.done()); |
33 .then(() => task.done()); | 33 }); |
34 }); | |
35 | 34 |
36 | 35 |
37 // Task: Check if a stereo input is being down-mixed to mono channel | 36 // Task: Check if a stereo input is being down-mixed to mono channel |
38 // correctly based on the mixing rule. | 37 // correctly based on the mixing rule. |
39 audit.define('stereo-down-mixing', (task, should) => { | 38 audit.define('stereo-down-mixing', (task, should) => { |
40 testMergerInput(should, { | 39 testMergerInput(should, { |
41 numberOfChannels: 7, | 40 numberOfChannels: 7, |
42 | |
43 // Create a stereo buffer filled with '1' and '2' for left and right | |
44 // channels respectively. | |
45 testBufferContent: [1, 2], | |
46 | 41 |
47 // Connect the output of source into the 7th input of merger. | 42 // Create a stereo buffer filled with '1' and '2' for left and right |
48 mergerInputIndex: 6, | 43 // channels respectively. |
| 44 testBufferContent: [1, 2], |
49 | 45 |
50 // The result of summed and down-mixed stereo audio should be 1.5. | 46 // Connect the output of source into the 7th input of merger. |
51 // (= 1 * 0.5 + 2 * 0.5) | 47 mergerInputIndex: 6, |
52 expected: [0, 0, 0, 0, 0, 0, 1.5], | 48 |
53 }) | 49 // The result of summed and down-mixed stereo audio should be 1.5. |
54 .then(() => task.done()); | 50 // (= 1 * 0.5 + 2 * 0.5) |
55 }); | 51 expected: [0, 0, 0, 0, 0, 0, 1.5], |
| 52 }).then(() => task.done()); |
| 53 }); |
56 | 54 |
57 | 55 |
58 // Task: Check if 3-channel input gets processed by the 'discrete' mixing | 56 // Task: Check if 3-channel input gets processed by the 'discrete' mixing |
59 // rule. | 57 // rule. |
60 audit.define('undefined-channel-layout', (task, should) => { | 58 audit.define('undefined-channel-layout', (task, should) => { |
61 testMergerInput(should, { | 59 testMergerInput(should, { |
62 numberOfChannels: 7, | 60 numberOfChannels: 7, |
63 | |
64 // Create a 3-channel buffer filled with '1', '2', and '3' respectively. | |
65 testBufferContent: [1, 2, 3], | |
66 | 61 |
67 // Connect the output of source into the 7th input of merger. | 62 // Create a 3-channel buffer filled with '1', '2', and '3' |
68 mergerInputIndex: 6, | 63 // respectively. |
| 64 testBufferContent: [1, 2, 3], |
69 | 65 |
70 // The result of summed stereo audio should be 1 because 3-channel is | 66 // Connect the output of source into the 7th input of merger. |
71 // not a canonical layout, so the input channel 2 and 3 should be | 67 mergerInputIndex: 6, |
72 // dropped by 'discrete' mixing rule. | |
73 expected: [0, 0, 0, 0, 0, 0, 1], | |
74 }) | |
75 .then(() => task.done()); | |
76 }); | |
77 | 68 |
78 audit.run(); | 69 // The result of summed stereo audio should be 1 because 3-channel is |
79 </script> | 70 // not a canonical layout, so the input channel 2 and 3 should be |
80 </body> | 71 // dropped by 'discrete' mixing rule. |
| 72 expected: [0, 0, 0, 0, 0, 0, 1], |
| 73 }).then(() => task.done()); |
| 74 }); |
81 | 75 |
| 76 audit.run(); |
| 77 </script> |
| 78 </body> |
82 </html> | 79 </html> |
OLD | NEW |