OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <!-- | 3 <!-- |
4 This is a very basic test to make sure testRunner.setAudioData() works correctly
. | 4 This is a very basic test to make sure testRunner.setAudioData() works correctly
. |
5 It generates a 2 seconds long stereo result @44.1KHz | 5 It generates a 2 seconds long stereo result @44.1KHz |
6 The left channel will be a 880Hz tone, while the right will be 440Hz. | 6 The left channel will be a 880Hz tone, while the right will be 440Hz. |
7 --> | 7 --> |
8 | 8 |
9 <html> | 9 <html> |
10 <head> | 10 <head> |
(...skipping 21 matching lines...) Expand all Loading... |
32 for (var i = 0; i < n; ++i) { | 32 for (var i = 0; i < n; ++i) { |
33 channelL[i] = Math.sin(880.0 * 2.0*Math.PI * i / sampleRate); | 33 channelL[i] = Math.sin(880.0 * 2.0*Math.PI * i / sampleRate); |
34 channelR[i] = Math.sin(440.0 * 2.0*Math.PI * i / sampleRate); | 34 channelR[i] = Math.sin(440.0 * 2.0*Math.PI * i / sampleRate); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 function runTest() { | 38 function runTest() { |
39 if (!window.testRunner) | 39 if (!window.testRunner) |
40 return; | 40 return; |
41 | 41 |
42 var context = new webkitAudioContext(); | 42 var context = new AudioContext(); |
43 var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, samp
leRate); | 43 var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, samp
leRate); |
44 | 44 |
45 generateSinWave(audioBuffer); | 45 generateSinWave(audioBuffer); |
46 | 46 |
47 var audioData = createAudioData(audioBuffer); | 47 var audioData = createAudioData(audioBuffer); |
48 testRunner.setAudioData(audioData); | 48 testRunner.setAudioData(audioData); |
49 | 49 |
50 testRunner.notifyDone(); | 50 testRunner.notifyDone(); |
51 } | 51 } |
52 | 52 |
53 runTest(); | 53 runTest(); |
54 | 54 |
55 </script> | 55 </script> |
56 | 56 |
57 | 57 |
58 <body> | 58 <body> |
59 </body> | 59 </body> |
60 </html> | 60 </html> |
OLD | NEW |