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 <script type="text/javascript" src="resources/buffer-loader.js"></script> | 8 <script type="text/javascript" src="resources/buffer-loader.js"></script> |
8 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 | 12 |
12 <div id="description"></div> | 13 <div id="description"></div> |
13 <div id="console"></div> | 14 <div id="console"></div> |
14 | 15 |
15 <script> | 16 <script> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 function runTest() { | 102 function runTest() { |
102 if (window.testRunner) { | 103 if (window.testRunner) { |
103 testRunner.dumpAsText(); | 104 testRunner.dumpAsText(); |
104 testRunner.waitUntilDone(); | 105 testRunner.waitUntilDone(); |
105 } | 106 } |
106 | 107 |
107 window.jsTestIsAsync = true; | 108 window.jsTestIsAsync = true; |
108 | 109 |
109 // Create offline audio context. | 110 // Create offline audio context. |
110 context = new webkitOfflineAudioContext(1, numberOfRenderFrames, sampleRate)
; | 111 context = new OfflineAudioContext(1, numberOfRenderFrames, sampleRate); |
111 | 112 |
112 // source -> waveshaper -> destination | 113 // source -> waveshaper -> destination |
113 var source = context.createBufferSource(); | 114 var source = context.createBufferSource(); |
114 var waveshaper = context.createWaveShaper(); | 115 var waveshaper = context.createWaveShaper(); |
115 source.connect(waveshaper); | 116 source.connect(waveshaper); |
116 waveshaper.connect(context.destination); | 117 waveshaper.connect(context.destination); |
117 | 118 |
118 // Create an input test vector. | 119 // Create an input test vector. |
119 inputBuffer = generateInputBuffer(); | 120 inputBuffer = generateInputBuffer(); |
120 source.buffer = inputBuffer; | 121 source.buffer = inputBuffer; |
121 | 122 |
122 // We'll apply non-linear distortion according to this shaping curve. | 123 // We'll apply non-linear distortion according to this shaping curve. |
123 waveShapingCurve = generateWaveShapingCurve(); | 124 waveShapingCurve = generateWaveShapingCurve(); |
124 waveshaper.curve = waveShapingCurve; | 125 waveshaper.curve = waveShapingCurve; |
125 | 126 |
126 source.start(0); | 127 source.start(0); |
127 | 128 |
128 context.oncomplete = checkShapedCurve; | 129 context.oncomplete = checkShapedCurve; |
129 context.startRendering(); | 130 context.startRendering(); |
130 } | 131 } |
131 | 132 |
132 runTest(); | 133 runTest(); |
133 | 134 |
134 </script> | 135 </script> |
135 | 136 |
136 </body> | 137 </body> |
137 </html> | 138 </html> |
OLD | NEW |