OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 | 3 |
4 <head> | 4 <head> |
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/audit.js"></script> |
9 <script src="../resources/merger-testing.js"></script> | 9 <script src="../resources/merger-testing.js"></script> |
10 </head> | 10 </head> |
11 | 11 |
12 <body> | 12 <body> |
13 <script> | 13 <script> |
14 | 14 |
15 var audit = Audit.createTaskRunner(); | 15 var 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.defineTask('silent-channel', function (done) { | 20 audit.define('silent-channel', (task, should) => { |
21 testMergerInput({ | 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 }, done); | 32 }) |
| 33 .then(() => task.done()); |
33 }); | 34 }); |
34 | 35 |
35 | 36 |
36 // Task: Check if a stereo input is being down-mixed to mono channel | 37 // Task: Check if a stereo input is being down-mixed to mono channel |
37 // correctly based on the mixing rule. | 38 // correctly based on the mixing rule. |
38 audit.defineTask('stereo-down-mixing', function (done) { | 39 audit.define('stereo-down-mixing', (task, should) => { |
39 testMergerInput({ | 40 testMergerInput(should, { |
40 numberOfChannels: 7, | 41 numberOfChannels: 7, |
41 | 42 |
42 // Create a stereo buffer filled with '1' and '2' for left and right | 43 // Create a stereo buffer filled with '1' and '2' for left and right |
43 // channels respectively. | 44 // channels respectively. |
44 testBufferContent: [1, 2], | 45 testBufferContent: [1, 2], |
45 | 46 |
46 // Connect the output of source into the 7th input of merger. | 47 // Connect the output of source into the 7th input of merger. |
47 mergerInputIndex: 6, | 48 mergerInputIndex: 6, |
48 | 49 |
49 // The result of summed and down-mixed stereo audio should be 1.5. | 50 // The result of summed and down-mixed stereo audio should be 1.5. |
50 // (= 1 * 0.5 + 2 * 0.5) | 51 // (= 1 * 0.5 + 2 * 0.5) |
51 expected: [0, 0, 0, 0, 0, 0, 1.5], | 52 expected: [0, 0, 0, 0, 0, 0, 1.5], |
52 }, done); | 53 }) |
| 54 .then(() => task.done()); |
53 }); | 55 }); |
54 | 56 |
55 | 57 |
56 // Task: Check if 3-channel input gets processed by the 'discrete' mixing | 58 // Task: Check if 3-channel input gets processed by the 'discrete' mixing |
57 // rule. | 59 // rule. |
58 audit.defineTask('undefined-channel-layout', function (done) { | 60 audit.define('undefined-channel-layout', (task, should) => { |
59 testMergerInput({ | 61 testMergerInput(should, { |
60 numberOfChannels: 7, | 62 numberOfChannels: 7, |
61 | 63 |
62 // Create a 3-channel buffer filled with '1', '2', and '3' respectively. | 64 // Create a 3-channel buffer filled with '1', '2', and '3' respectively. |
63 testBufferContent: [1, 2, 3], | 65 testBufferContent: [1, 2, 3], |
64 | 66 |
65 // Connect the output of source into the 7th input of merger. | 67 // Connect the output of source into the 7th input of merger. |
66 mergerInputIndex: 6, | 68 mergerInputIndex: 6, |
67 | 69 |
68 // The result of summed stereo audio should be 1 because 3-channel is | 70 // The result of summed stereo audio should be 1 because 3-channel is |
69 // not a canonical layout, so the input channel 2 and 3 should be | 71 // not a canonical layout, so the input channel 2 and 3 should be |
70 // dropped by 'discrete' mixing rule. | 72 // dropped by 'discrete' mixing rule. |
71 expected: [0, 0, 0, 0, 0, 0, 1], | 73 expected: [0, 0, 0, 0, 0, 0, 1], |
72 }, done); | 74 }) |
| 75 .then(() => task.done()); |
73 }); | 76 }); |
74 | 77 |
75 audit.defineTask('finish', function (done) { | 78 audit.run(); |
76 done(); | |
77 }); | |
78 | |
79 audit.runTasks( | |
80 'silent-channel', | |
81 'stereo-down-mixing', | |
82 'undefined-channel-layout', | |
83 'finish' | |
84 ); | |
85 | |
86 successfullyParsed = true; | |
87 </script> | 79 </script> |
88 </body> | 80 </body> |
89 | 81 |
90 </html> | 82 </html> |
OLD | NEW |