| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Validate Reduction Value of DynamicsComporessor after Disabling</titl
e> | 4 <title>Validate Reduction Value of DynamicsComporessor after Disabling</titl
e> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 8 </head> | 9 </head> |
| 9 | 10 |
| 10 <body> | 11 <body> |
| 11 <script> | 12 <script> |
| 12 description("Validate Reduction Value of DynamicsComporessor after Disabli
ng"); | 13 let audit = Audit.createTaskRunner(); |
| 14 let context; |
| 15 let buffer; |
| 16 let source; |
| 17 let compressor; |
| 13 | 18 |
| 14 var context; | 19 let sampleRate = 44100; |
| 15 var buffer; | 20 let testDurationSamples = 44100; |
| 16 var source; | |
| 17 var compressor; | |
| 18 var renderedData; | |
| 19 | 21 |
| 20 var sampleRate = 44100; | 22 audit.define("test", function (task, should) { |
| 21 var testDurationSamples = 44100; | 23 task.describe( |
| 22 | 24 "Validate Reduction Value of DynamicsCompressor after Disabling" |
| 23 function checkResult (event) { | 25 ); |
| 24 | |
| 25 renderedData = event.renderedBuffer.getChannelData(0); | |
| 26 | |
| 27 // Check that the reduction value is 0.0. | |
| 28 if (compressor.reduction !== 0.0) { | |
| 29 testFailed("Expected reduction of 0.0, but the value is " + compre
ssor.reduction); | |
| 30 } | |
| 31 else { | |
| 32 testPassed("Reduction is 0.0"); | |
| 33 } | |
| 34 | |
| 35 finishJSTest(); | |
| 36 } | |
| 37 | |
| 38 function runTest() { | |
| 39 window.jsTestIsAsync = true; | |
| 40 | |
| 41 // Create the offline context for the test. | 26 // Create the offline context for the test. |
| 42 context = new OfflineAudioContext(1, testDurationSamples, sampleRate); | 27 context = new OfflineAudioContext(1, testDurationSamples, sampleRate); |
| 43 context.oncomplete = checkResult; | |
| 44 | 28 |
| 45 // Create the constant sample buffer of 0.5 sec. | 29 // Create the constant sample buffer of 0.5 sec. |
| 46 buffer = createConstantBuffer(context, testDurationSamples / 2, 1); | 30 buffer = createConstantBuffer(context, testDurationSamples / 2, 1); |
| 47 | 31 |
| 48 // Create compressor and use default parameters for the compression. | 32 // Create compressor and use default parameters for the compression. |
| 49 compressor = context.createDynamicsCompressor(); | 33 compressor = context.createDynamicsCompressor(); |
| 50 | 34 |
| 51 // Create the source and connect it to the destination | 35 // Create the source and connect it to the destination |
| 52 source = context.createBufferSource(); | 36 source = context.createBufferSource(); |
| 53 source.buffer = buffer; | 37 source.buffer = buffer; |
| 54 source.connect(compressor); | 38 source.connect(compressor); |
| 55 compressor.connect(context.destination); | 39 compressor.connect(context.destination); |
| 56 source.start(0.0); | 40 source.start(0.0); |
| 57 | 41 |
| 58 // Render it! | 42 // Render it! |
| 59 context.startRendering(); | 43 context.startRendering() |
| 60 } | 44 .then(() => { |
| 45 // Check that the reduction value is 0.0. |
| 46 should(compressor.reduction, "compressor.reduction") |
| 47 .beEqualTo(0); |
| 48 task.done(); |
| 49 }); |
| 50 }); |
| 61 | 51 |
| 62 runTest(); | 52 audit.run(); |
| 63 succesfullyParsed = true; | |
| 64 </script> | 53 </script> |
| 65 </body> | 54 </body> |
| 66 </html> | 55 </html> |
| OLD | NEW |