audioparam-setValueAtTime.html (1967B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> 5 audioparam-setValueAtTime.html 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 <script src="/webaudio/resources/audit.js"></script> 11 <script src="/webaudio/resources/audioparam-testing.js"></script> 12 </head> 13 <body> 14 <script id="layout-test-code"> 15 let audit = Audit.createTaskRunner(); 16 17 // Play a long DC signal out through an AudioGainNode, and call 18 // setValueAtTime() at regular intervals to set the value for the duration 19 // of the interval. Each time interval has different value so that there 20 // is a discontinuity at each time interval boundary. The discontinuity 21 // is for testing timing. 22 23 // Number of tests to run. 24 let numberOfTests = 100; 25 26 // Max allowed difference between the rendered data and the expected 27 // result. 28 let maxAllowedError = 6e-8; 29 30 // Set the gain node value to the specified value at the specified time. 31 function setValue(value, time) { 32 gainNode.gain.setValueAtTime(value, time); 33 } 34 35 // For testing setValueAtTime(), we don't need to do anything for 36 // automation. because the value at the beginning of the interval is set 37 // by setValue and it remains constant for the duration, which is what we 38 // want. 39 function automation(value, startTime, endTime) { 40 // Do nothing. 41 } 42 43 audit.define( 44 { 45 label: 'test', 46 description: 'AudioParam setValueAtTime() functionality.' 47 }, 48 function(task, should) { 49 createAudioGraphAndTest( 50 task, should, numberOfTests, 1, setValue, automation, 51 'setValueAtTime()', maxAllowedError, createConstantArray); 52 }); 53 54 audit.run(); 55 </script> 56 </body> 57 </html>