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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/dynamicscompressor-simple.html

Issue 1807583002: DynamicsCompressor.reduction is a float not an AudioParam (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script> 5 <script src="resources/compatibility.js"></script>
6 <script type="text/javascript" src="resources/audio-testing.js"></script> 6 <script type="text/javascript" src="resources/audio-testing.js"></script>
7 </head> 7 </head>
8 8
9 <body> 9 <body>
10 <div id="description"></div> 10 <div id="description"></div>
11 <div id="console"></div> 11 <div id="console"></div>
12 12
13 <script> 13 <script>
14 description("Test pre-emphasis in DynamicsCompressor is removed"); 14 description("Test pre-emphasis in DynamicsCompressor is removed");
15 var context; 15 var context;
16 var compressor;
16 var sampleRate = 44100; 17 var sampleRate = 44100;
17 var lengthInSeconds = 1; 18 var lengthInSeconds = 1;
18 var renderedData; 19 var renderedData;
19 // This threshold experimentally determined. It depends on the the gain va lue of the gain node 20 // This threshold experimentally determined. It depends on the the gain va lue of the gain node
20 // below and the dynamics compressor. When the DynamicsCompressor had the pre-emphasis 21 // below and the dynamics compressor. When the DynamicsCompressor had the pre-emphasis
21 // filters, the peak value is about 0.21. Without it, the peak is about 0 .84. 22 // filters, the peak value is about 0.21. Without it, the peak is about 0 .84.
22 var peakThreshold = 0.83; 23 var peakThreshold = 0.83;
23 24
24 function checkResult(event) { 25 function checkResult(event) {
25 var renderedBuffer = event.renderedBuffer; 26 var renderedBuffer = event.renderedBuffer;
(...skipping 10 matching lines...) Expand all
36 peak = sample; 37 peak = sample;
37 } 38 }
38 39
39 if (peak >= peakThreshold) { 40 if (peak >= peakThreshold) {
40 testPassed("Pre-emphasis effect not applied as expected.."); 41 testPassed("Pre-emphasis effect not applied as expected..");
41 } else { 42 } else {
42 testFailed("Pre-emphasis caused output to be decreased to " + peak 43 testFailed("Pre-emphasis caused output to be decreased to " + peak
43 + " (expected >= " + peakThreshold + ")"); 44 + " (expected >= " + peakThreshold + ")");
44 } 45 }
45 46
47 if (compressor.reduction)
48 testPassed("Reduction value changed as expected.")
49 else
50 testFailed("Reduction value is still the default value of 0.");
46 finishJSTest(); 51 finishJSTest();
47 } 52 }
48 53
49 function runTest() { 54 function runTest() {
50 if (!window.testRunner) {
51 testRunner.dumpAsTest();
52 testRunner.waitUntilDone();
53 }
54
55 window.jsTestIsAsync = true; 55 window.jsTestIsAsync = true;
56 56
57 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampl eRate); 57 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampl eRate);
58 // Connect an oscillator to a gain node to the compressor. The 58 // Connect an oscillator to a gain node to the compressor. The
59 // oscillator frequency is set to a high value for the (original) 59 // oscillator frequency is set to a high value for the (original)
60 // emphasis to kick in. The gain is a little extra boost to get the 60 // emphasis to kick in. The gain is a little extra boost to get the
61 // compressor enabled. 61 // compressor enabled.
62 // 62 //
63 var osc = context.createOscillator(); 63 var osc = context.createOscillator();
64 osc.frequency.value = 15000; 64 osc.frequency.value = 15000;
65 var gain = context.createGain(); 65 var gain = context.createGain();
66 gain.gain.value = 1.5; 66 gain.gain.value = 1.5;
67 var compressor = context.createDynamicsCompressor(); 67 compressor = context.createDynamicsCompressor();
68 osc.connect(gain); 68 osc.connect(gain);
69 gain.connect(compressor); 69 gain.connect(compressor);
70 compressor.connect(context.destination); 70 compressor.connect(context.destination);
71 osc.start(); 71 osc.start();
72 context.oncomplete = checkResult; 72 context.oncomplete = checkResult;
73 context.startRendering(); 73 context.startRendering();
74 } 74 }
75 75
76 runTest(); 76 runTest();
77 successfullyParsed = true; 77 successfullyParsed = true;
78 78
79 </script> 79 </script>
80 80
81 </body> 81 </body>
82 </html> 82 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698