tor-browser

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

convolver-channels.html (1403B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      Test Supported Number of Channels for ConvolverNode
      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  </head>
     12  <body>
     13    <script id="layout-test-code">
     14      let audit = Audit.createTaskRunner();
     15 
     16      audit.define('channel-count-test', (task, should) => {
     17        // Just need a context to create nodes on, so any allowed length and
     18        // rate is ok.
     19        let context = new OfflineAudioContext(1, 1, 48000);
     20 
     21        let success = true;
     22 
     23        for (let count = 1; count <= 32; ++count) {
     24          let convolver = context.createConvolver();
     25          let buffer = context.createBuffer(count, 1, context.sampleRate);
     26          let message = 'ConvolverNode with buffer of ' + count + ' channels';
     27 
     28          if (count == 1 || count == 2 || count == 4) {
     29            // These are the only valid channel counts for the buffer.
     30            should(() => convolver.buffer = buffer, message).notThrow();
     31          } else {
     32            should(() => convolver.buffer = buffer, message)
     33                .throw(DOMException, 'NotSupportedError');
     34          }
     35        }
     36 
     37        task.done();
     38      });
     39 
     40      audit.run();
     41    </script>
     42  </body>
     43 </html>