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

Side by Side Diff: LayoutTests/webaudio/deprecated-audiobuffersource-looping.html

Issue 140973002: Remove AudioBufferSourceNode.looping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove looping test Created 6 years, 11 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
« no previous file with comments | « no previous file | LayoutTests/webaudio/deprecated-audiobuffersource-looping-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="resources/audio-testing.js"></script>
6 <script src="resources/audiobuffersource-testing.js"></script>
7 <script src="../resources/js-test.js"></script>
8 </head>
9
10 <body>
11
12 <div id="description"></div>
13 <div id="console"></div>
14
15 <script>
16 description("Tests AudioBufferSourceNode looping with a variety of loop points." );
17
18 // The following test cases assume an AudioBuffer of length 8 whose PCM data is a linear ramp, 0, 1, 2, 3,...
19
20 var tests = [
21
22 { description: "loop whole buffer by default with loopStart == loopEnd == 0",
23 loopStartFrame: 0, loopEndFrame: 0, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
24
25 { description: "loop whole buffer explicitly",
26 loopStartFrame: 0, loopEndFrame: 8, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
27
28 { description: "loop from middle to end of buffer",
29 loopStartFrame: 4, loopEndFrame: 8, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,7,4,5,6,7,4,5,6,7] },
30
31 { description: "loop from start to middle of buffer",
32 loopStartFrame: 0, loopEndFrame: 4, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3] },
33
34 { description: "loop internally from 4 -> 6",
35 loopStartFrame: 4, loopEndFrame: 6, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,4,5,4,5,4,5,4,5,4,5] },
36
37 { description: "loop internally from 3 -> 7",
38 loopStartFrame: 3, loopEndFrame: 7, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,3,4,5,6,3,4,5,6,3] },
39
40 { description: "loop internally from 4 -> 6 with playbackRate of 0.5",
41 loopStartFrame: 4, loopEndFrame: 6, renderFrames: 16, playbackRate: 0.5, expec ted: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 4, 4.5, 5, 5.5] },
42
43 { description: "loop internally from 4 -> 6 with playbackRate of 1.5",
44 loopStartFrame: 4, loopEndFrame: 6, renderFrames: 16, playbackRate: 1.5, expec ted: [0, 1.5, 3, 4.5, 4, 5.5, 5, 4.5, 4, 5.5, 5, 4.5, 4, 5.5, 5, 4.5] },
45
46 { description: "illegal playbackRate of 47 greater than loop length",
47 loopStartFrame: 4, loopEndFrame: 6, renderFrames: 16, playbackRate: 47, expect ed: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] },
48
49 // Try illegal loop-points - they should be ignored and we'll loop the whole buf fer.
50
51 { description: "illegal loop: loopStartFrame > loopEndFrame",
52 loopStartFrame: 7, loopEndFrame: 3, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
53
54 { description: "illegal loop: loopStartFrame == loopEndFrame",
55 loopStartFrame: 3, loopEndFrame: 3, renderFrames: 16, playbackRate: 1, expecte d: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
56
57 { description: "illegal loop: loopStartFrame < 0",
58 loopStartFrame: -45, loopEndFrame: 3, renderFrames: 16, playbackRate: 1, expec ted: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
59
60 { description: "illegal loop: loopEndFrame > bufferLength",
61 loopStartFrame: 0, loopEndFrame: 30000, renderFrames: 16, playbackRate: 1, exp ected: [0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7] },
62
63 ];
64
65 var sampleRate = 44100;
66 var buffer;
67 var bufferFrameLength = 8;
68 var testSpacingFrames = 32;
69 var testSpacingSeconds = testSpacingFrames / sampleRate;
70 var totalRenderLengthFrames = tests.length * testSpacingFrames;
71
72 function runLoopTest(context, testNumber, test) {
73 var source = context.createBufferSource();
74
75 source.buffer = buffer;
76 source.playbackRate.value = test.playbackRate;
77 source.looping = true;
78 source.loopStart = test.loopStartFrame / context.sampleRate;
79 source.loopEnd = test.loopEndFrame / context.sampleRate;
80
81 source.connect(context.destination);
82
83 // Render each test one after the other, spaced apart by testSpacingSeconds.
84 var startTime = testNumber * testSpacingSeconds;
85 var duration = test.renderFrames / context.sampleRate;
86 source.start(startTime);
87 source.stop(startTime + duration);
88 }
89
90 function runTest() {
91 if (window.testRunner) {
92 testRunner.dumpAsText();
93 testRunner.waitUntilDone();
94 }
95
96 window.jsTestIsAsync = true;
97
98 // Create offline audio context.
99 var context = new webkitOfflineAudioContext(1, totalRenderLengthFrames, samp leRate);
100 buffer = createTestBuffer(context, bufferFrameLength);
101
102 for (var i = 0; i < tests.length; ++i)
103 runLoopTest(context, i, tests[i]);
104
105 context.oncomplete = checkAllTests;
106 context.startRendering();
107 }
108
109 runTest();
110 successfullyParsed = true;
111
112 </script>
113
114 </body>
115 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/webaudio/deprecated-audiobuffersource-looping-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698