Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Osc with ExponentialRamp (crbug.com/522229)</title> | |
| 5 </head> | |
| 6 | |
| 7 <body> | |
| 8 <script> | |
|
hongchan
2015/10/01 20:20:52
Let us move the script section to the end of body.
| |
| 9 var context = new AudioContext(); | |
| 10 var sawosc = 0; | |
|
hongchan
2015/10/01 20:20:52
0 is not necessary.
| |
| 11 | |
| 12 function updateOsc(event) { | |
| 13 var freq = Math.random() * 440 + 440; | |
|
hongchan
2015/10/01 20:20:52
Be sure to avoid the case freq = 0. Perhaps we can
Raymond Toy
2015/10/01 20:31:23
How can freq be 0? Math.random() returns numbers
hongchan
2015/10/01 22:14:48
Oops. Sorry. I blindly thought it is -1~1. Please
| |
| 14 console.log(context.currentTime); | |
|
hongchan
2015/10/01 20:20:52
Let's remove the console print out.
| |
| 15 sawosc.frequency.exponentialRampToValueAtTime(freq, context.currentTime + 0.025); | |
| 16 } | |
| 17 | |
| 18 function startTest() { | |
| 19 sawosc = context.createOscillator(); | |
| 20 sawosc.type = 'sawtooth'; | |
| 21 sawosc.connect(context.destination); | |
| 22 window.addEventListener('keydown', updateOsc); | |
| 23 sawosc.start(); | |
| 24 } | |
| 25 | |
| 26 function stopTest() { | |
| 27 window.removeEventListener('keydown', updateOsc); | |
| 28 sawosc.stop(); | |
| 29 } | |
| 30 </script> | |
| 31 | |
| 32 <p> | |
| 33 Test from <a href="crbug.com/522229">crbug.com/522229</a>. This test cann ot be validated | |
| 34 using an offline context because it requires user interaction. | |
| 35 </p> | |
| 36 <p> | |
| 37 Press the start button to start the test and the stop button to stop it | |
|
hongchan
2015/10/01 20:20:52
A missing period at the end.
| |
| 38 </p> | |
| 39 <p> | |
| 40 Press any set of keys quickly and listen. At no point should audio ever b e silent. There | |
| 41 should be no glitches either. If either of these happens, this test has f ailed. | |
| 42 </p> | |
| 43 <button onclick="startTest()">Start</button> | |
| 44 <button onclick="stopTest()">Stop</button> | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |