Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: ManualTests/webaudio/audiobuffersource-loop-grain.html

Issue 912803005: Looping AudioBufferSourceNodes stop only if duration is explicitly given. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Loop AudioBufferSourceNode, with buffer set after start</title>
5 <script>
6 var context = new AudioContext() || new webkitAudioContext();
7 var normalSource;
8 var delayedSource
9 var buffer;
10 var request = new XMLHttpRequest();
11 request.open("GET", "../../LayoutTests/webaudio/resources/media/128kbps-44 khz.mp3", true);
12 request.responseType = "arraybuffer";
13 request.onload = function() {
14 context.decodeAudioData(request.response,
15 function(b) {
16 buffer = b;
17 document.getElementById("Start").disabled = false;
18 document.getElementById("StartDelayed").disabled = false;
19 },
20 function () {
21 alert("Could not load file");
22 });
23 };
24 request.send();
25
26 function normalStart() {
27 console.log("normalStart");
28 normalSource = context.createBufferSource();
29 normalSource.loop = true;
30 normalSource.buffer = buffer;
31 normalSource.connect(context.destination);
32 normalSource.start(context.currentTime + 2, 0);
33 }
34 function delayedStart() {
35 console.log("delayedStart");
36 delayedSource = context.createBufferSource();
37 delayedSource.loop = true;
38 delayedSource.connect(context.destination);
39 delayedSource.start(context.currentTime + 2, 0);
40 setTimeout(function () {
41 delayedSource.buffer = buffer;
42 }, 1000);
43 }
44 </script>
45 </head>
46
47 <body>
48 <h1>Loop AudioBufferSourceNode, with buffer set after start</h1>
49
50 <p>Test that looping an AudioBufferSource works correctly if the source is s tarted and the
51 buffer is assigned later, but before the source would start. This can't be easily tested in an
52 offline context because we can't precisely control when the assignment of th e buffer to the
53 source is done.</p>
54
55 <p>Press the "Start" button for the normal case where the buffer is assigned before start.</p>
56
57 <p>Press the "Start delayed" button for the case where the source is started and the buffer
58 assigned later.</p>
59
60 <p>You should hear audio about 2 sec after pressing the button. It should c ontinue until you
61 press the corresponding Stop button.</p>
62
63 <button id="Start" disabled onclick='normalStart()'>Start</button>
64 <button id="Stop" onclick="normalSource.stop()">Stop</button>
65 <br>
66 <button id="StartDelayed" disabled onclick='delayedStart()'>Start Delayed</b utton>
67 <button id="StopDelayed" onclick='delayedSource.stop()'>Stop Delayed Source< /button>
68
69
70 <hr>
71 <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.
72 <!-- Created: Tue Feb 10 15:14:56 PST 2015 -->
73 <!-- hhmts start -->
74 Last modified: Tue Feb 10 15:51:39 PST 2015
75 <!-- hhmts end -->
76 </body>
77 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698