| 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/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audit.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| 11 <body> | 11 <body> |
| 12 <script> | 12 <script> |
| 13 let audit = Audit.createTaskRunner(); | 13 let audit = Audit.createTaskRunner(); |
| 14 let context; | 14 let context; |
| 15 let buffer; | 15 let buffer; |
| 16 let source; | 16 let source; |
| 17 let compressor; | 17 let compressor; |
| 18 | 18 |
| 19 let sampleRate = 44100; | 19 let sampleRate = 44100; |
| 20 let testDurationSamples = 44100; | 20 let testDurationSamples = 44100; |
| 21 | 21 |
| 22 audit.define("test", function (task, should) { | 22 audit.define( |
| 23 task.describe( | 23 { |
| 24 "Validate Reduction Value of DynamicsCompressor after Disabling" | 24 label: 'test', |
| 25 ); | 25 description: |
| 26 // Create the offline context for the test. | 26 'Validate Reduction Value of DynamicsCompressor after Disabling' |
| 27 context = new OfflineAudioContext(1, testDurationSamples, sampleRate); | 27 }, |
| 28 function(task, should) { |
| 29 // Create the offline context for the test. |
| 30 context = |
| 31 new OfflineAudioContext(1, testDurationSamples, sampleRate); |
| 28 | 32 |
| 29 // Create the constant sample buffer of 0.5 sec. | 33 // Create the constant sample buffer of 0.5 sec. |
| 30 buffer = createConstantBuffer(context, testDurationSamples / 2, 1); | 34 buffer = createConstantBuffer(context, testDurationSamples / 2, 1); |
| 31 | 35 |
| 32 // Create compressor and use default parameters for the compression. | 36 // Create compressor and use default parameters for the compression. |
| 33 compressor = context.createDynamicsCompressor(); | 37 compressor = context.createDynamicsCompressor(); |
| 34 | 38 |
| 35 // Create the source and connect it to the destination | 39 // Create the source and connect it to the destination |
| 36 source = context.createBufferSource(); | 40 source = context.createBufferSource(); |
| 37 source.buffer = buffer; | 41 source.buffer = buffer; |
| 38 source.connect(compressor); | 42 source.connect(compressor); |
| 39 compressor.connect(context.destination); | 43 compressor.connect(context.destination); |
| 40 source.start(0.0); | 44 source.start(0.0); |
| 41 | 45 |
| 42 // Render it! | 46 // Render it! |
| 43 context.startRendering() | 47 context.startRendering().then(() => { |
| 44 .then(() => { | 48 // Check that the reduction value is 0.0. |
| 45 // Check that the reduction value is 0.0. | 49 should(compressor.reduction, 'compressor.reduction').beEqualTo(0); |
| 46 should(compressor.reduction, "compressor.reduction") | 50 task.done(); |
| 47 .beEqualTo(0); | |
| 48 task.done(); | |
| 49 }); | 51 }); |
| 50 }); | 52 }); |
| 51 | 53 |
| 52 audit.run(); | 54 audit.run(); |
| 53 </script> | 55 </script> |
| 54 </body> | 56 </body> |
| 55 </html> | 57 </html> |
| OLD | NEW |