| 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 53%
|
| copy from LayoutTests/webaudio/audiobuffersource-one-sample-loop.html
|
| copy to LayoutTests/webaudio/dynamicscompressor-clear-internal-state.html
|
| index f15d77e0b6a774a962f6858ef3f4cc930e211ae3..f327cdabfe1eea4be750f1a49290cbb83e2c4b49 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) {
|
| + testFailed("Expected reduction of 0.0, but the value is " + compressor.reduction.value);
|
| }
|
| - if (success)
|
| - testPassed("All samples equal to 1");
|
| + else {
|
| + testPassed("Reduction is 0.0");
|
| + }
|
| +
|
| finishJSTest();
|
| }
|
|
|
| @@ -43,15 +42,18 @@
|
| 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.
|
| + buffer = createConstantBuffer(context, testDurationSamples / 2, 1);
|
| +
|
| + // Create compressor and use default parameters for the compression.
|
| + compressor = context.createDynamicsCompressor();
|
|
|
| // 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.connect(compressor);
|
| + compressor.connect(context.destination);
|
| + source.start(0.0);
|
|
|
| // Render it!
|
| context.startRendering();
|
|
|