OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
| 6 <script src="resources/compatibility.js"></script> |
6 <script type="text/javascript" src="resources/audio-testing.js"></script> | 7 <script type="text/javascript" src="resources/audio-testing.js"></script> |
7 </head> | 8 </head> |
8 | 9 |
9 <body> | 10 <body> |
10 | 11 |
11 <div id="description"></div> | 12 <div id="description"></div> |
12 <div id="console"></div> | 13 <div id="console"></div> |
13 | 14 |
14 <script> | 15 <script> |
15 description("This test verifies that the AudioBasicInspectorNode based nodes wor
k correctly."); | 16 description("This test verifies that the AudioBasicInspectorNode based nodes wor
k correctly."); |
16 | 17 |
17 var sampleRate = 44100.0; | 18 var sampleRate = 44100.0; |
18 // We carefully arrange the renderLengthInFrames to be a multiple of the AudioNo
de rendering quantum (AudioNode::ProcessingSizeInFrames) | 19 // We carefully arrange the renderLengthInFrames to be a multiple of the AudioNo
de rendering quantum (AudioNode::ProcessingSizeInFrames) |
19 // so that AudioSourceNode will not feed tailing zeroes into the context and fai
l this test. | 20 // so that AudioSourceNode will not feed tailing zeroes into the context and fai
l this test. |
20 var renderLengthInFrames = 256; | 21 var renderLengthInFrames = 256; |
21 var fftSize = 64; | 22 var fftSize = 64; |
22 | 23 |
23 var audioDataOne = 255; // Audio data 1.0 in Uint8 format will be 255. | 24 var audioDataOne = 255; // Audio data 1.0 in Uint8 format will be 255. |
24 var audioDataZero = 128; // Audio data 0 in Uint8 format will be 128. | 25 var audioDataZero = 128; // Audio data 0 in Uint8 format will be 128. |
25 | 26 |
26 var context; | 27 var context; |
27 var constantBuffer; | 28 var constantBuffer; |
28 var bufferSource; | 29 var bufferSource; |
29 var analyser; | 30 var analyser; |
30 | 31 |
31 function constructCommonGraph() { | 32 function constructCommonGraph() { |
32 // Create offline audio context. | 33 // Create offline audio context. |
33 context = new webkitOfflineAudioContext(1, renderLengthInFrames, sampleRate)
; | 34 context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate); |
34 constantBuffer = createConstantBuffer(context, renderLengthInFrames, 1); | 35 constantBuffer = createConstantBuffer(context, renderLengthInFrames, 1); |
35 | 36 |
36 bufferSource = context.createBufferSource(); | 37 bufferSource = context.createBufferSource(); |
37 bufferSource.buffer = constantBuffer; | 38 bufferSource.buffer = constantBuffer; |
38 | 39 |
39 analyser = context.createAnalyser(); | 40 analyser = context.createAnalyser(); |
40 analyser.fftSize = fftSize; | 41 analyser.fftSize = fftSize; |
41 | 42 |
42 bufferSource.connect(analyser); | 43 bufferSource.connect(analyser); |
43 } | 44 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 test1(); | 129 test1(); |
129 } | 130 } |
130 | 131 |
131 runTest(); | 132 runTest(); |
132 | 133 |
133 </script> | 134 </script> |
134 | 135 |
135 </body> | 136 </body> |
136 </html> | 137 </html> |
OLD | NEW |