tor-browser

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

note-grain-on-timing.html (1379B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      note-grain-on-timing.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/note-grain-on-testing.js"></script>
     12  </head>
     13  <body>
     14    <script id="layout-test-code">
     15      let audit = Audit.createTaskRunner();
     16 
     17      let squarePulseBuffer;
     18 
     19      function checkResult(buffer, should) {
     20        renderedData = buffer.getChannelData(0);
     21        let nSamples = renderedData.length;
     22        let startEndFrames = findStartAndEndSamples(renderedData);
     23 
     24        verifyStartAndEndFrames(startEndFrames, should);
     25      }
     26 
     27      audit.define('Test timing of noteGrainOn', function(task, should) {
     28        // Create offline audio context.
     29        context =
     30            new OfflineAudioContext(2, sampleRate * renderTime, sampleRate);
     31 
     32        squarePulseBuffer = createSignalBuffer(context, function(k) {
     33          return 1
     34        });
     35 
     36        playAllGrains(context, squarePulseBuffer, numberOfTests);
     37 
     38        context.startRendering().then(function(audioBuffer) {
     39          checkResult(audioBuffer, should);
     40          task.done();
     41        });
     42      });
     43 
     44      audit.run();
     45    </script>
     46  </body>
     47 </html>