| OLD | NEW |
| 1 var defaultSampleRate = 44100.0; | 1 var defaultSampleRate = 44100.0; |
| 2 var lengthInSeconds = 1; | 2 var lengthInSeconds = 1; |
| 3 | 3 |
| 4 var context = 0; | 4 var context = 0; |
| 5 var bufferLoader = 0; | 5 var bufferLoader = 0; |
| 6 | 6 |
| 7 // Run test by loading the file specified by |url|. An optional sample rate can
be given to | 7 // Run test by loading the file specified by |url|. An optional sample rate can
be given to |
| 8 // select a context with a different sample rate. The default value is |default
SampleRate|. | 8 // select a context with a different sample rate. The default value is |default
SampleRate|. |
| 9 function runDecodingTest(url, optionalSampleRate) | 9 function runDecodingTest(url, optionalSampleRate) |
| 10 { | 10 { |
| 11 if (!window.testRunner) | 11 if (!window.testRunner) |
| 12 return; | 12 return; |
| 13 | 13 |
| 14 var sampleRate = (typeof optionalSampleRate === "undefined") ? defaultSample
Rate : optionalSampleRate; | 14 var sampleRate = (typeof optionalSampleRate === "undefined") ? defaultSample
Rate : optionalSampleRate; |
| 15 | 15 |
| 16 // Create offline audio context. | 16 // Create offline audio context. |
| 17 context = new webkitOfflineAudioContext(1, sampleRate * lengthInSeconds, sam
pleRate); | 17 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRat
e); |
| 18 | 18 |
| 19 bufferLoader = new BufferLoader( | 19 bufferLoader = new BufferLoader( |
| 20 context, | 20 context, |
| 21 [ url ], | 21 [ url ], |
| 22 finishedLoading | 22 finishedLoading |
| 23 ); | 23 ); |
| 24 | 24 |
| 25 bufferLoader.load(); | 25 bufferLoader.load(); |
| 26 testRunner.waitUntilDone(); | 26 testRunner.waitUntilDone(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function finishedLoading(bufferList) | 29 function finishedLoading(bufferList) |
| 30 { | 30 { |
| 31 testRunner.setAudioData(createAudioData(bufferList[0])); | 31 testRunner.setAudioData(createAudioData(bufferList[0])); |
| 32 testRunner.notifyDone(); | 32 testRunner.notifyDone(); |
| 33 } | 33 } |
| 34 | 34 |
| OLD | NEW |