| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Tests that AudioBufferSourceNode supports loop-points with .loopStart and .loopE
nd. | 4 Tests that AudioBufferSourceNode supports loop-points with .loopStart and .loopE
nd. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 <script type="text/javascript" src="resources/audio-testing.js"></script> | 9 <script type="text/javascript" src="resources/audio-testing.js"></script> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 gainNode.gain.value = 1; | 75 gainNode.gain.value = 1; |
| 76 gainNode.gain.setValueAtTime(1, time + duration - 0.005); | 76 gainNode.gain.setValueAtTime(1, time + duration - 0.005); |
| 77 gainNode.gain.linearRampToValueAtTime(0, time + duration); | 77 gainNode.gain.linearRampToValueAtTime(0, time + duration); |
| 78 } | 78 } |
| 79 | 79 |
| 80 function init() { | 80 function init() { |
| 81 if (!window.testRunner) | 81 if (!window.testRunner) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 // Create offline audio context. | 84 // Create offline audio context. |
| 85 context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sam
pleRate); | 85 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRat
e); |
| 86 | 86 |
| 87 // Create the test buffer. | 87 // Create the test buffer. |
| 88 // We'll loop this with the loop-points set for the 2nd half of this buffer. | 88 // We'll loop this with the loop-points set for the 2nd half of this buffer. |
| 89 buffer = createTestBuffer(440.0, sampleRate); | 89 buffer = createTestBuffer(440.0, sampleRate); |
| 90 | 90 |
| 91 // Play all the notes as a chromatic scale. | 91 // Play all the notes as a chromatic scale. |
| 92 for (var i = 0; i < numberOfNotes; ++i) { | 92 for (var i = 0; i < numberOfNotes; ++i) { |
| 93 var time = i * noteSpacing; | 93 var time = i * noteSpacing; |
| 94 var semitone = i - numberOfNotes/2; // start three octaves down | 94 var semitone = i - numberOfNotes/2; // start three octaves down |
| 95 | 95 |
| 96 // Convert from semitone to rate. | 96 // Convert from semitone to rate. |
| 97 var playbackRate = Math.pow(2, semitone / 12); | 97 var playbackRate = Math.pow(2, semitone / 12); |
| 98 | 98 |
| 99 playNote(time, noteDuration, playbackRate); | 99 playNote(time, noteDuration, playbackRate); |
| 100 } | 100 } |
| 101 | 101 |
| 102 context.oncomplete = finishAudioTest; | 102 context.oncomplete = finishAudioTest; |
| 103 context.startRendering(); | 103 context.startRendering(); |
| 104 | 104 |
| 105 testRunner.waitUntilDone(); | 105 testRunner.waitUntilDone(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 </script> | 108 </script> |
| 109 | 109 |
| 110 </body> | 110 </body> |
| 111 </html> | 111 </html> |
| OLD | NEW |