realtimeanalyser-basic.html (1409B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> 5 Basic AnalyserNode test 6 </title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/webaudio/resources/audit-util.js"></script> 10 </head> 11 <body> 12 <script> 13 test(() => { 14 const context = new AudioContext(); 15 const analyser = new AnalyserNode(context); 16 17 assert_equals( 18 analyser.numberOfInputs, 1, 'Number of inputs for AnalyserNode'); 19 20 assert_equals( 21 analyser.numberOfOutputs, 1, 'Number of outputs for AnalyserNode'); 22 23 assert_equals(analyser.minDecibels, -100, 'Default minDecibels value'); 24 25 assert_equals(analyser.maxDecibels, -30, 'Default maxDecibels value'); 26 27 assert_equals( 28 analyser.smoothingTimeConstant, 29 0.8, 30 'Default smoothingTimeConstant value'); 31 32 let expectedValue = -50 - (1 / 3); 33 analyser.minDecibels = expectedValue; 34 35 assert_equals( 36 analyser.minDecibels, expectedValue, 37 `node.minDecibels = ${expectedValue}`); 38 39 expectedValue = -40 - (1 / 3); 40 analyser.maxDecibels = expectedValue; 41 42 assert_equals( 43 analyser.maxDecibels, expectedValue, 44 `node.maxDecibels = ${expectedValue}`); 45 }, 'Basic AnalyserNode test'); 46 </script> 47 </body> 48 </html>