tor-browser

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

test_oscillatorNodePassThrough.html (1099B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test Oscillator with passthrough</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script type="text/javascript" src="webaudio.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8 </head>
      9 <body>
     10 <pre id="test">
     11 <script class="testbody" type="text/javascript">
     12 
     13 var gTest = {
     14  length: 2048,
     15  numberOfChannels: 1,
     16  createGraph(context) {
     17    var buffer = context.createBuffer(1, 2048, context.sampleRate);
     18    for (var i = 0; i < 2048; ++i) {
     19      buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
     20    }
     21 
     22    var source = context.createOscillator();
     23 
     24    var srcWrapped = SpecialPowers.wrap(source);
     25    ok("passThrough" in srcWrapped, "OscillatorNode should support the passThrough API");
     26    srcWrapped.passThrough = true;
     27 
     28    source.start(0);
     29    return source;
     30  },
     31  createExpectedBuffers(context) {
     32    var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
     33 
     34    return [expectedBuffer];
     35  },
     36 };
     37 
     38 runTest();
     39 
     40 </script>
     41 </pre>
     42 </body>
     43 </html>