content/media/webaudio/test/test_pannerNodeChannelCount.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webaudio/test/test_pannerNodeChannelCount.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test PannerNode directly above</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +</head>
    1.11 +<body>
    1.12 +<pre id="test">
    1.13 +<script src="webaudio.js" type="text/javascript"></script>
    1.14 +<script class="testbody" type="text/javascript">
    1.15 +
    1.16 +var gTest = {
    1.17 +  length: 2048,
    1.18 +  numberOfChannels: 2,
    1.19 +  createGraph: function(context) {
    1.20 +    var buffer = context.createBuffer(2, 2048, context.sampleRate);
    1.21 +    for (var i = 0; i < 2048; ++i) {
    1.22 +      var sample = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
    1.23 +      // When mixed into a single channel, this produces silence
    1.24 +      buffer.getChannelData(0)[i] = sample;
    1.25 +      buffer.getChannelData(1)[i] = -sample;
    1.26 +    }
    1.27 +
    1.28 +    var panner = context.createPanner();
    1.29 +    panner.setPosition(1, 2, 3);
    1.30 +    panner.channelCount = 1;
    1.31 +    expectException(function() { panner.channelCount = 3; },
    1.32 +                    DOMException.NOT_SUPPORTED_ERR);
    1.33 +    panner.channelCountMode = "explicit";
    1.34 +    expectException(function() { panner.channelCountMode = "max"; },
    1.35 +                    DOMException.NOT_SUPPORTED_ERR);
    1.36 +    panner.channelInterpretation = "discrete";
    1.37 +    panner.channelInterpretation = "speakers";
    1.38 +
    1.39 +    var source = context.createBufferSource();
    1.40 +    source.buffer = buffer;
    1.41 +    source.connect(panner);
    1.42 +    source.start(0);
    1.43 +
    1.44 +    return panner;
    1.45 +  },
    1.46 +};
    1.47 +
    1.48 +runTest();
    1.49 +
    1.50 +</script>
    1.51 +</pre>
    1.52 +</body>
    1.53 +</html>

mercurial