| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Create two sources and play them simultaneously. This tests unity-gain summing
of AudioNode inputs. | 4 Create two sources and play them simultaneously. This tests unity-gain summing
of AudioNode inputs. |
| 5 The result should be some laughing playing at the same time as the drumming. | 5 The result should be some laughing playing at the same time as the drumming. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <html> | 8 <html> |
| 9 <head> | 9 <head> |
| 10 <script src="../resources/testharness.js"></script> | 10 <script src="../resources/testharness.js"></script> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 source1.start(0); | 61 source1.start(0); |
| 62 source2.start(0); | 62 source2.start(0); |
| 63 | 63 |
| 64 // Verify the number of channels in each source and the expected result. | 64 // Verify the number of channels in each source and the expected result. |
| 65 should(bufferList[0].numberOfChannels, 'Number of channels in stereo source') | 65 should(bufferList[0].numberOfChannels, 'Number of channels in stereo source') |
| 66 .beEqualTo(2); | 66 .beEqualTo(2); |
| 67 | 67 |
| 68 should(bufferList[1].numberOfChannels, 'Number of channels in mono source') | 68 should(bufferList[1].numberOfChannels, 'Number of channels in mono source') |
| 69 .beEqualTo(1); | 69 .beEqualTo(1); |
| 70 | 70 |
| 71 return context.startRendering().then(verifyResult); | 71 return context.startRendering().then(audioBuffer => { |
| 72 verifyResult(audioBuffer, context, bufferList, testThresholds, should); |
| 73 }); |
| 72 } | 74 } |
| 73 | 75 |
| 74 function verifyResult(renderedBuffer) { | 76 function verifyResult(renderedBuffer, context, bufferList, testThresholds, shoul
d) { |
| 75 // Test only works if we have a stereo result. | 77 // Test only works if we have a stereo result. |
| 76 should( | 78 should( |
| 77 renderedBuffer.numberOfChannels, 'Number of channels in rendered output') | 79 renderedBuffer.numberOfChannels, 'Number of channels in rendered output') |
| 78 .beEqualTo(2); | 80 .beEqualTo(2); |
| 79 | 81 |
| 80 // Note: the source lengths may not match the context length. Create copies | 82 // Note: the source lengths may not match the context length. Create copies |
| 81 // of the sources truncated or zero-filled to the rendering length. | 83 // of the sources truncated or zero-filled to the rendering length. |
| 82 | 84 |
| 83 let stereoSource = new AudioBuffer({ | 85 let stereoSource = new AudioBuffer({ |
| 84 length: renderedBuffer.length, | 86 length: renderedBuffer.length, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 .beGreaterThanOrEqualTo(threshold.snrThreshold); | 126 .beGreaterThanOrEqualTo(threshold.snrThreshold); |
| 125 should(actualData, 'Rendered audio').beCloseToArray(expectedData, { | 127 should(actualData, 'Rendered audio').beCloseToArray(expectedData, { |
| 126 absoluteThreshold: threshold.errorThreshold | 128 absoluteThreshold: threshold.errorThreshold |
| 127 }); | 129 }); |
| 128 } | 130 } |
| 129 } | 131 } |
| 130 </script> | 132 </script> |
| 131 | 133 |
| 132 </body> | 134 </body> |
| 133 </html> | 135 </html> |
| OLD | NEW |