content/media/webaudio/test/test_audioBufferSourceNodeLazyLoopParam.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 AudioBufferSourceNode</title>
     5   <script type="text/javascript" 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">
    13 var gTest = {
    14   length: 4096,
    15   numberOfChannels: 1,
    16   createGraph: function(context) {
    17     // silence for half of the buffer, ones after that.
    18     var buffer = context.createBuffer(1, 2048, context.sampleRate);
    19     for (var i = 1024; i < 2048; i++) {
    20       buffer.getChannelData(0)[i] = 1;
    21     }
    23     var source = context.createBufferSource();
    25     // we start at the 1024 frames, we should only have ones.
    26     source.loop = true;
    27     source.loopStart = 1024 / context.sampleRate;
    28     source.loopEnd = 2048 / context.sampleRate;
    29     source.buffer = buffer;
    30     source.start(0, 1024 / context.sampleRate, 1024 / context.sampleRate);
    31     return source;
    32   },
    33   createExpectedBuffers: function(context) {
    34     var expectedBuffer = context.createBuffer(1, 4096, context.sampleRate);
    35     for (var i = 0; i < 4096; i++) {
    36       expectedBuffer.getChannelData(0)[i] = 1;
    37     }
    38     return expectedBuffer;
    39   },
    40 };
    42 runTest();
    44 </script>
    45 </pre>
    46 </body>
    47 </html>

mercurial