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