tor-browser

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

cycle-without-delay.html (1073B)


      1 <!DOCTYPE html>
      2 <html class="a">
      3  <head>
      4    <title>Cycles without DelayNode in audio node graph</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7  </head>
      8  <body>
      9    <script>
     10      function doTest() {
     11        var off = new OfflineAudioContext(1, 512, 48000);
     12        var osc = new OscillatorNode(off);
     13        var fb = new GainNode(off);
     14        // zero delay feedback loop
     15        osc.connect(fb).connect(fb).connect(off.destination);
     16        osc.start(0);
     17        return off.startRendering().then((b) => {
     18          return Promise.resolve(b.getChannelData(0));
     19        });
     20      }
     21 
     22      promise_test(() => {
     23        return doTest().then(samples => {
     24          var silent = true;
     25          for (var i = 0; i < samples.length; i++) {
     26            if (samples[i] != 0.0) {
     27              silent = false;
     28              break;
     29            }
     30          }
     31          assert_true(silent);
     32        });
     33      }, 'Test that cycles that don\'t contain a DelayNode are muted');
     34    </script>
     35  </body>
     36 </html>