4 <title>Validate Reduction Value of DynamicsComporessor after Disabling
</title>
5 <script src=
"resources/compatibility.js"></script>
6 <script src=
"resources/audio-testing.js"></script>
7 <script src=
"../resources/js-test.js"></script>
12 description("Validate Reduction Value of DynamicsComporessor after Disabling");
20 var sampleRate
= 44100;
21 var testDurationSamples
= 44100;
23 function checkResult (event
) {
25 renderedData
= event
.renderedBuffer
.getChannelData(0);
27 // Check that the reduction value is 0.0.
28 if (compressor
.reduction
.value
!== 0.0) {
29 testFailed("Expected reduction of 0.0, but the value is " + compressor
.reduction
.value
);
32 testPassed("Reduction is 0.0");
39 window
.jsTestIsAsync
= true;
41 // Create the offline context for the test.
42 context
= new OfflineAudioContext(1, testDurationSamples
, sampleRate
);
43 context
.oncomplete
= checkResult
;
45 // Create the constant sample buffer of 0.5 sec.
46 buffer
= createConstantBuffer(context
, testDurationSamples
/ 2, 1);
48 // Create compressor and use default parameters for the compression.
49 compressor
= context
.createDynamicsCompressor();
51 // Create the source and connect it to the destination
52 source
= context
.createBufferSource();
53 source
.buffer
= buffer
;
54 source
.connect(compressor
);
55 compressor
.connect(context
.destination
);
59 context
.startRendering();
63 succesfullyParsed
= true;