content/media/webaudio/test/test_audioBufferSourceNodeEnded.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 ended event on 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 SimpleTest.waitForExplicitFinish();
    14 addLoadEvent(function() {
    15   var context = new AudioContext();
    16   var buffer = context.createBuffer(1, 2048, context.sampleRate);
    17   for (var i = 0; i < 2048; ++i) {
    18     buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
    19   }
    21   var source = context.createBufferSource();
    23   source.onended = function(e) {
    24     is(e.target, source, "Correct target for the ended event");
    25     SimpleTest.finish();
    26   };
    28   source.start(0);
    29   source.buffer = buffer;
    30   source.connect(context.destination);
    31 });
    33 </script>
    34 </pre>
    35 </body>
    36 </html>

mercurial