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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html
diff --git a/LayoutTests/webaudio/audiobuffersource-one-sample-loop.html b/LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html
similarity index 55%
copy from LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
copy to LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html
index f15d77e0b6a774a962f6858ef3f4cc930e211ae3..244449daa4d3fdeae1331ce9db4cd0f9a07859e4 100644
--- a/LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
+++ b/LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Test AudioBufferSourceNode With Looping a Single-Sample Buffer</title>
+ <title>Validate Reduction Value of DynamicsComporessor after Disabling</title>
<script src="resources/compatibility.js"></script>
<script src="resources/audio-testing.js"></script>
<script src="../resources/js-test.js"></script>
@@ -9,30 +9,29 @@
<body>
<script>
- description("Test AudioBufferSourceNode With Looping a Single-Sample Buffer");
+ description("Validate Reduction Value of DynamicsComporessor after Disabling");
var context;
- var source;
var buffer;
+ var source;
+ var compressor;
var renderedData;
var sampleRate = 44100;
- var testDurationSamples = 1000;
+ var testDurationSamples = 44100;
function checkResult (event) {
var success = true;
renderedData = event.renderedBuffer.getChannelData(0);
- // Check that the rendered data is all ones, like the buffer source.
- for (k = 0; k < renderedData.length; ++k) {
- if (renderedData[k] != 1) {
- success = false;
- testFailed("Expected all ones, but sample " + k + " is " + renderedData[k]);
- break;
- }
+
+ // Check that the reduction value is 0.0.
+ if (compressor.reduction.value !== 0.0) {
+ success = false;
+ testFailed("Expected reduction of 0.0, but the value is " + compressor.reduction.value);
}
Raymond Toy 2014/10/21 19:28:56 I would simplify this by removing the variable suc
hongchan 2014/10/21 20:20:37 I tried to keep the code untouched as much as poss
if (success)
- testPassed("All samples equal to 1");
+ testPassed("Reduction is 0.0");
finishJSTest();
}
@@ -43,15 +42,20 @@
context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
context.oncomplete = checkResult;
- // Create the single sample buffer
- buffer = createConstantBuffer(context, 1, 1);
+ // Create the constant sample buffer of 0.5 sec.
Raymond Toy 2014/10/21 19:28:56 Correct the comment. It's not 0.5 sec, right?
hongchan 2014/10/21 20:20:37 I have to figure out this problem - because the li
+ buffer = createConstantBuffer(context, testDurationSamples / 2, 1);
+
+ // Create comporessor and set parameters accordingly.
+ compressor = context.createDynamicsCompressor();
Raymond Toy 2014/10/21 19:28:56 The compressor doesn't seem to have anything conne
hongchan 2014/10/21 20:20:37 The same problem, the changes were not applied to
+ compressor.threshold.value = -24.0;
+ compressor.ratio.value = -8.0;
Raymond Toy 2014/10/21 19:28:56 Why these values? Does it really matter for the te
hongchan 2014/10/21 20:20:37 This is to make sure that the compression to actua
// Create the source and connect it to the destination
source = context.createBufferSource();
source.buffer = buffer;
- source.loop = true;
source.connect(context.destination);
- source.start();
+ source.start(0.0);
+ source.stop(0.5);
Raymond Toy 2014/10/21 19:28:56 Why 0.5 sec? The value of testDurationSamples is m
hongchan 2014/10/21 20:20:37 The reason behind this is that we play the buffer
// Render it!
context.startRendering();

Powered by Google App Engine
This is Rietveld 408576698