Chromium Code Reviews| Index: ManualTests/webaudio/audiobuffersource-loop-grain.html |
| diff --git a/ManualTests/webaudio/audiobuffersource-loop-grain.html b/ManualTests/webaudio/audiobuffersource-loop-grain.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0b39bb3177d30fe55bf5986285c633a2b98bb10f |
| --- /dev/null |
| +++ b/ManualTests/webaudio/audiobuffersource-loop-grain.html |
| @@ -0,0 +1,77 @@ |
| +<!doctype html> |
| +<html> |
| + <head> |
| + <title>Loop AudioBufferSourceNode, with buffer set after start</title> |
| + <script> |
| + var context = new AudioContext() || new webkitAudioContext(); |
| + var normalSource; |
| + var delayedSource |
| + var buffer; |
| + var request = new XMLHttpRequest(); |
| + request.open("GET", "../../LayoutTests/webaudio/resources/media/128kbps-44khz.mp3", true); |
| + request.responseType = "arraybuffer"; |
| + request.onload = function() { |
| + context.decodeAudioData(request.response, |
| + function(b) { |
| + buffer = b; |
| + document.getElementById("Start").disabled = false; |
| + document.getElementById("StartDelayed").disabled = false; |
| + }, |
| + function () { |
| + alert("Could not load file"); |
| + }); |
| + }; |
| + request.send(); |
| + |
| + function normalStart() { |
| + console.log("normalStart"); |
| + normalSource = context.createBufferSource(); |
| + normalSource.loop = true; |
| + normalSource.buffer = buffer; |
| + normalSource.connect(context.destination); |
| + normalSource.start(context.currentTime + 2, 0); |
| + } |
| + function delayedStart() { |
| + console.log("delayedStart"); |
| + delayedSource = context.createBufferSource(); |
| + delayedSource.loop = true; |
| + delayedSource.connect(context.destination); |
| + delayedSource.start(context.currentTime + 2, 0); |
| + setTimeout(function () { |
| + delayedSource.buffer = buffer; |
| + }, 1000); |
| + } |
| + </script> |
| + </head> |
| + |
| + <body> |
| + <h1>Loop AudioBufferSourceNode, with buffer set after start</h1> |
| + |
| + <p>Test that looping an AudioBufferSource works correctly if the source is started and the |
| + buffer is assigned later, but before the source would start. This can't be easily tested in an |
| + offline context because we can't precisely control when the assignment of the buffer to the |
| + source is done.</p> |
| + |
| + <p>Press the "Start" button for the normal case where the buffer is assigned before start.</p> |
| + |
| + <p>Press the "Start delayed" button for the case where the source is started and the buffer |
| + assigned later.</p> |
| + |
| + <p>You should hear audio about 2 sec after pressing the button. It should continue until you |
| + press the corresponding Stop button.</p> |
| + |
| + <button id="Start" disabled onclick='normalStart()'>Start</button> |
| + <button id="Stop" onclick="normalSource.stop()">Stop</button> |
| + <br> |
| + <button id="StartDelayed" disabled onclick='delayedStart()'>Start Delayed</button> |
| + <button id="StopDelayed" onclick='delayedSource.stop()'>Stop Delayed Source</button> |
| + |
| + |
| + <hr> |
| + <address><a href="mailto:rtoy@google.com">Raymond Toy</a></address> |
|
hongchan
2015/02/12 18:36:58
What does this part do? Is this needed for the man
Raymond Toy
2015/02/12 21:36:42
Oops. My editor does that automatically. I'll rem
Raymond Toy
2015/02/13 20:07:06
Removed.
|
| +<!-- Created: Tue Feb 10 15:14:56 PST 2015 --> |
| +<!-- hhmts start --> |
| +Last modified: Tue Feb 10 15:51:39 PST 2015 |
| +<!-- hhmts end --> |
| + </body> |
| +</html> |