content/media/webaudio/test/test_pannerNodeChannelCount.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test PannerNode directly above</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     7 </head>
     8 <body>
     9 <pre id="test">
    10 <script src="webaudio.js" type="text/javascript"></script>
    11 <script class="testbody" type="text/javascript">
    13 var gTest = {
    14   length: 2048,
    15   numberOfChannels: 2,
    16   createGraph: function(context) {
    17     var buffer = context.createBuffer(2, 2048, context.sampleRate);
    18     for (var i = 0; i < 2048; ++i) {
    19       var sample = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
    20       // When mixed into a single channel, this produces silence
    21       buffer.getChannelData(0)[i] = sample;
    22       buffer.getChannelData(1)[i] = -sample;
    23     }
    25     var panner = context.createPanner();
    26     panner.setPosition(1, 2, 3);
    27     panner.channelCount = 1;
    28     expectException(function() { panner.channelCount = 3; },
    29                     DOMException.NOT_SUPPORTED_ERR);
    30     panner.channelCountMode = "explicit";
    31     expectException(function() { panner.channelCountMode = "max"; },
    32                     DOMException.NOT_SUPPORTED_ERR);
    33     panner.channelInterpretation = "discrete";
    34     panner.channelInterpretation = "speakers";
    36     var source = context.createBufferSource();
    37     source.buffer = buffer;
    38     source.connect(panner);
    39     source.start(0);
    41     return panner;
    42   },
    43 };
    45 runTest();
    47 </script>
    48 </pre>
    49 </body>
    50 </html>

mercurial