| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Tests that GainNode is properly scaling the gain. | 4 Tests that GainNode is properly scaling the gain. |
| 5 We'll render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. | 5 We'll render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. |
| 6 The 11th note will be of gain 0.0, so it should be silent (at the end in the ren
dered output). | 6 The 11th note will be of gain 0.0, so it should be silent (at the end in the ren
dered output). |
| 7 --> | 7 --> |
| 8 | 8 |
| 9 <html> | 9 <html> |
| 10 <head> | 10 <head> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 gainNode.connect(context.destination); | 52 gainNode.connect(context.destination); |
| 53 | 53 |
| 54 source.start(time); | 54 source.start(time); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function init() { | 57 function init() { |
| 58 if (!window.testRunner) | 58 if (!window.testRunner) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 // Create offline audio context. | 61 // Create offline audio context. |
| 62 context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sam
pleRate); | 62 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRat
e); |
| 63 | 63 |
| 64 // Create a buffer for a short "note". | 64 // Create a buffer for a short "note". |
| 65 sinWaveBuffer = createSinWaveBuffer(bufferDurationSeconds, 880.0); | 65 sinWaveBuffer = createSinWaveBuffer(bufferDurationSeconds, 880.0); |
| 66 | 66 |
| 67 // Render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. | 67 // Render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. |
| 68 // The last note will be of gain 0.0, so shouldn't be perceptible in the ren
dered output. | 68 // The last note will be of gain 0.0, so shouldn't be perceptible in the ren
dered output. |
| 69 for (var i = 0; i < numberOfNotes; ++i) { | 69 for (var i = 0; i < numberOfNotes; ++i) { |
| 70 var time = i * noteSpacing; | 70 var time = i * noteSpacing; |
| 71 var gain = 1.0 - i / (numberOfNotes - 1); | 71 var gain = 1.0 - i / (numberOfNotes - 1); |
| 72 playNote(time, gain); | 72 playNote(time, gain); |
| 73 } | 73 } |
| 74 | 74 |
| 75 context.oncomplete = finishAudioTest; | 75 context.oncomplete = finishAudioTest; |
| 76 context.startRendering(); | 76 context.startRendering(); |
| 77 | 77 |
| 78 testRunner.waitUntilDone(); | 78 testRunner.waitUntilDone(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 </script> | 81 </script> |
| 82 | 82 |
| 83 </body> | 83 </body> |
| 84 </html> | 84 </html> |
| OLD | NEW |