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

Side by Side Diff: LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html

Issue 645853010: Make reduction value of dynamics compressor zero when no sources are connected (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | LayoutTests/webaudio/dynamicscompressor-clear-internal-state-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
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test AudioBufferSourceNode With Looping a Single-Sample Buffer</title > 4 <title>Validate Reduction Value of DynamicsComporessor after Disabling</titl e>
5 <script src="resources/compatibility.js"></script> 5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script> 6 <script src="resources/audio-testing.js"></script>
7 <script src="../resources/js-test.js"></script> 7 <script src="../resources/js-test.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
11 <script> 11 <script>
12 description("Test AudioBufferSourceNode With Looping a Single-Sample Buffe r"); 12 description("Validate Reduction Value of DynamicsComporessor after Disabli ng");
13 13
14 var context; 14 var context;
15 var buffer;
15 var source; 16 var source;
16 var buffer; 17 var compressor;
17 var renderedData; 18 var renderedData;
18 19
19 var sampleRate = 44100; 20 var sampleRate = 44100;
20 var testDurationSamples = 1000; 21 var testDurationSamples = 44100;
21 22
22 function checkResult (event) { 23 function checkResult (event) {
23 var success = true;
24 24
25 renderedData = event.renderedBuffer.getChannelData(0); 25 renderedData = event.renderedBuffer.getChannelData(0);
26 // Check that the rendered data is all ones, like the buffer source. 26
27 for (k = 0; k < renderedData.length; ++k) { 27 // Check that the reduction value is 0.0.
28 if (renderedData[k] != 1) { 28 if (compressor.reduction.value !== 0.0) {
29 success = false; 29 testFailed("Expected reduction of 0.0, but the value is " + compre ssor.reduction.value);
30 testFailed("Expected all ones, but sample " + k + " is " + ren deredData[k]);
31 break;
32 }
33 } 30 }
34 if (success) 31 else {
35 testPassed("All samples equal to 1"); 32 testPassed("Reduction is 0.0");
33 }
34
36 finishJSTest(); 35 finishJSTest();
37 } 36 }
38 37
39 function runTest() { 38 function runTest() {
40 window.jsTestIsAsync = true; 39 window.jsTestIsAsync = true;
41 40
42 // Create the offline context for the test. 41 // Create the offline context for the test.
43 context = new OfflineAudioContext(1, testDurationSamples, sampleRate); 42 context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
44 context.oncomplete = checkResult; 43 context.oncomplete = checkResult;
45 44
46 // Create the single sample buffer 45 // Create the constant sample buffer of 0.5 sec.
47 buffer = createConstantBuffer(context, 1, 1); 46 buffer = createConstantBuffer(context, testDurationSamples / 2, 1);
47
48 // Create compressor and use default parameters for the compression.
49 compressor = context.createDynamicsCompressor();
48 50
49 // Create the source and connect it to the destination 51 // Create the source and connect it to the destination
50 source = context.createBufferSource(); 52 source = context.createBufferSource();
51 source.buffer = buffer; 53 source.buffer = buffer;
52 source.loop = true; 54 source.connect(compressor);
53 source.connect(context.destination); 55 compressor.connect(context.destination);
54 source.start(); 56 source.start(0.0);
55 57
56 // Render it! 58 // Render it!
57 context.startRendering(); 59 context.startRendering();
58 } 60 }
59 61
60 runTest(); 62 runTest();
61 succesfullyParsed = true; 63 succesfullyParsed = true;
62 </script> 64 </script>
63 </body> 65 </body>
64 </html> 66 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/webaudio/dynamicscompressor-clear-internal-state-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698