tor-browser

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

audioparam-linearRampToValueAtTime.html (2212B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      Test AudioParam.linearRampToValueAtTime
      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 linearRampToValueAtTime() at regular intervals to
     19      // set the starting and ending values for a linear ramp. Each time
     20      // interval has a ramp with a different starting and ending value so that
     21      // there is a discontinuity at each time interval boundary.  The
     22      // discontinuity is for testing timing.  Also, we alternate between an
     23      // 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.865e-6;
     31 
     32      // Set the gain node value to the specified value at the specified time.
     33      function setValue(value, time) {
     34        gainNode.gain.setValueAtTime(value, time);
     35      }
     36 
     37      // Generate a linear ramp ending at time |endTime| with an ending value of
     38      // |value|.
     39      function generateRamp(value, startTime, endTime){
     40          // |startTime| is ignored because the linear ramp uses the value from
     41          // the
     42          // setValueAtTime() call above.
     43          gainNode.gain.linearRampToValueAtTime(value, endTime)}
     44 
     45      audit.define(
     46          {
     47            label: 'test',
     48            description: 'AudioParam linearRampToValueAtTime() functionality'
     49          },
     50          function(task, should) {
     51            createAudioGraphAndTest(
     52                task, should, numberOfTests, 1, setValue, generateRamp,
     53                'linearRampToValueAtTime()', maxAllowedError,
     54                createLinearRampArray);
     55          });
     56 
     57      audit.run();
     58    </script>
     59  </body>
     60 </html>