tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

audioparam-exponentialRampToValueAtTime.html (2385B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      Test AudioParam.exponentialRampToValueAtTime
      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() and exponentialRampToValueAtTime() at regular
     19      // intervals to set the starting and ending values for an exponential
     20      // ramp.  Each time interval has a ramp with a different starting and
     21      // ending value so that there is a discontinuity at each time interval
     22      // boundary.  The discontinuity is for testing timing.  Also, we alternate
     23      // between an increasing and decreasing ramp for each interval.
     24 
     25      // Number of tests to run.
     26      let numberOfTests = 100;
     27 
     28      // Max allowed difference between the rendered data and the expected
     29      // result.
     30      let maxAllowedError = 1.222e-5;
     31 
     32      // The AudioGainNode starts with this value instead of the default value.
     33      let initialValue = 100;
     34 
     35      // Set the gain node value to the specified value at the specified time.
     36      function setValue(value, time) {
     37        gainNode.gain.setValueAtTime(value, time);
     38      }
     39 
     40      // Generate an exponential ramp ending at time |endTime| with an ending
     41      // value of |value|.
     42      function generateRamp(value, startTime, endTime){
     43          // |startTime| is ignored because the exponential ramp
     44          // uses the value from the setValueAtTime() call above.
     45          gainNode.gain.exponentialRampToValueAtTime(value, endTime)}
     46 
     47      audit.define(
     48          {
     49            label: 'test',
     50            description:
     51                'AudioParam exponentialRampToValueAtTime() functionality'
     52          },
     53          function(task, should) {
     54            createAudioGraphAndTest(
     55                task, should, numberOfTests, initialValue, setValue,
     56                generateRamp, 'exponentialRampToValueAtTime()', maxAllowedError,
     57                createExponentialRampArray);
     58          });
     59 
     60      audit.run();
     61    </script>
     62  </body>
     63 </html>