tor-browser

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

retrospective-test.js (1073B)


      1 // Create an audio graph on an offline context that consists of a
      2 // constant source and two gain nodes. One of the nodes is the node te
      3 // be tested and the other is the reference node.  The output from the
      4 // test node is in channel 0 of the offline context; the reference
      5 // node is in channel 1.
      6 //
      7 // Returns a dictionary with the context, source node, the test node,
      8 // and the reference node.
      9 function setupRetrospectiveGraph() {
     10  // Use a sample rate that is a power of two to eliminate round-off
     11  // in computing the currentTime.
     12  let context = new OfflineAudioContext(2, 16384, 16384);
     13  let source = new ConstantSourceNode(context);
     14 
     15  let test = new GainNode(context);
     16  let reference = new GainNode(context);
     17 
     18  source.connect(test);
     19  source.connect(reference);
     20 
     21  let merger = new ChannelMergerNode(
     22      context, {numberOfInputs: context.destination.channelCount});
     23  test.connect(merger, 0, 0);
     24  reference.connect(merger, 0, 1);
     25 
     26  merger.connect(context.destination);
     27 
     28  return {context: context, source: source, test: test, reference: reference};
     29 }