OLD | NEW |
---|---|
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test Convolver Channel Outputs for Response with 4 channels</title> | 4 <title>Test Convolver Channel Outputs for Response with 4 channels</title> |
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/audit.js"></script> | 8 <script src="../resources/audit.js"></script> |
9 </head> | 9 </head> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 audit.define( | 89 audit.define( |
90 { | 90 { |
91 label: '5.1-channel input', | 91 label: '5.1-channel input', |
92 description: '5.1->2 downmix producing 2-channel output' | 92 description: '5.1->2 downmix producing 2-channel output' |
93 }, | 93 }, |
94 (task, should) => { | 94 (task, should) => { |
95 fourChannelResponseTest({numberOfInputs: 6, prefix: '5.1'}, should) | 95 fourChannelResponseTest({numberOfInputs: 6, prefix: '5.1'}, should) |
96 .then(() => task.done()); | 96 .then(() => task.done()); |
97 }); | 97 }); |
98 | 98 |
99 audit.define( | |
100 { | |
101 label: 'delayed buffer set', | |
102 description: 'Delayed set of 4-channel response' | |
103 }, | |
104 (task, should) => { | |
105 // Don't reall care about the output for this test. It's to verify we | |
106 // don't crash in a debug build when setting the convolver buffer | |
107 // after creating the graph. | |
108 let context = new OfflineAudioContext(1, renderFrames, sampleRate); | |
109 let src = new OscillatorNode(context); | |
110 let convolver = new ConvolverNode(context, {disableNormalization: true }); | |
hongchan
2017/04/06 23:03:24
Please wrap at 80.
Raymond Toy
2017/04/07 14:51:48
Done.
| |
111 let buffer = new AudioBuffer({numberOfChannels: 4, length: 4, | |
112 sampleRate: context.sampleRate}); | |
hongchan
2017/04/06 23:03:24
Not properly indented.
Raymond Toy
2017/04/07 14:51:48
Done.
| |
113 | |
114 for (let k = 0; k < buffer.numberOfChannels; ++k) { | |
115 buffer.getChannelData(k).fill(1); | |
116 } | |
117 | |
118 src.connect(convolver).connect(context.destination); | |
119 | |
120 // Set the buffer after a few render quanta have passed. The actual | |
121 // value must be least one, but is otherwise arbitrary. | |
122 context.suspend(512 / context.sampleRate) | |
123 .then(() => { | |
hongchan
2017/04/06 23:03:24
We can remove the wrapping braces and make it into
Raymond Toy
2017/04/07 14:51:48
Done.
| |
124 convolver.buffer = buffer; | |
125 }) | |
126 .then(() => context.resume()); | |
127 | |
128 src.start(); | |
129 context.startRendering() | |
130 .then(audioBuffer => { | |
131 // Just make sure output is not silent | |
hongchan
2017/04/06 23:03:24
super nit: add a period at the end.
Raymond Toy
2017/04/07 14:51:47
Done.
| |
132 should(audioBuffer.getChannelData(0), | |
133 "Output with delayed setting of convolver buffer") | |
hongchan
2017/04/06 23:03:24
Please use single quotes.
Raymond Toy
2017/04/07 14:51:48
Done.
| |
134 .notBeConstantValueOf(0); | |
135 }) | |
136 .then(() => task.done()); | |
137 }); | |
138 | |
99 function fourChannelResponseTest(options, should) { | 139 function fourChannelResponseTest(options, should) { |
100 // Create an 4-channel offline context. The first two channels are for | 140 // Create an 4-channel offline context. The first two channels are for |
101 // the stereo output of the convolver and the next two channels are for | 141 // the stereo output of the convolver and the next two channels are for |
102 // the reference stereo signal. | 142 // the reference stereo signal. |
103 let context = new OfflineAudioContext(4, renderFrames, sampleRate); | 143 let context = new OfflineAudioContext(4, renderFrames, sampleRate); |
104 context.destination.channelInterpretation = 'discrete'; | 144 context.destination.channelInterpretation = 'discrete'; |
105 | 145 |
106 // Create oscillators for use as the input. The type and frequency is | 146 // Create oscillators for use as the input. The type and frequency is |
107 // arbitrary except that oscillators must be different. | 147 // arbitrary except that oscillators must be different. |
108 let src = new Array(options.numberOfInputs); | 148 let src = new Array(options.numberOfInputs); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 .beEqualToArray(expected0); | 246 .beEqualToArray(expected0); |
207 should(actual1, options.prefix + ': Channel 1') | 247 should(actual1, options.prefix + ': Channel 1') |
208 .beEqualToArray(expected1); | 248 .beEqualToArray(expected1); |
209 }); | 249 }); |
210 } | 250 } |
211 | 251 |
212 audit.run(); | 252 audit.run(); |
213 </script> | 253 </script> |
214 </body> | 254 </body> |
215 </html> | 255 </html> |
OLD | NEW |