content/media/webaudio/test/test_audioParamTimelineDestinationOffset.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webaudio/test/test_audioParamTimelineDestinationOffset.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test AudioParam timeline events scheduled after the destination stream has started playback</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="webaudio.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.11 +</head>
    1.12 +<body>
    1.13 +<pre id="test">
    1.14 +<script class="testbody" type="text/javascript">
    1.15 +
    1.16 +var gTest = {
    1.17 +  length: 16384,
    1.18 +  numberOfChannels: 1,
    1.19 +  createGraphAsync: function(context, callback) {
    1.20 +    var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
    1.21 +    for (var i = 0; i < 2048; ++i) {
    1.22 +      sourceBuffer.getChannelData(0)[i] = 1;
    1.23 +    }
    1.24 +
    1.25 +    setTimeout(function() {
    1.26 +      var source = context.createBufferSource();
    1.27 +      source.buffer = sourceBuffer;
    1.28 +      source.start(context.currentTime);
    1.29 +      source.stop(context.currentTime + sourceBuffer.duration);
    1.30 +
    1.31 +      var gain = context.createGain();
    1.32 +      gain.gain.setValueAtTime(0, context.currentTime);
    1.33 +      gain.gain.setTargetAtTime(0, context.currentTime + sourceBuffer.duration, 1);
    1.34 +      source.connect(gain);
    1.35 +
    1.36 +      callback(gain);
    1.37 +    }, 100);
    1.38 +  },
    1.39 +};
    1.40 +
    1.41 +runTest();
    1.42 +
    1.43 +</script>
    1.44 +</pre>
    1.45 +</body>
    1.46 +</html>

mercurial