gecko/content/media/webaudio/test/test_audioBufferSourceNodeGainInLoop.html
Ehsan Akhgari 19d51152a3 Bug 871201 - Part 2: Implement AudioBufferSourceNode.gain; r=roc
X-Git-Commit-ID: db8923b372db098aa7a5dc1cbf42674310b61aef
X-Mailer: git-send-email

--HG--
rename : content/media/webaudio/test/test_audioBufferSourceNode.html => content/media/webaudio/test/test_audioBufferSourceNodeGain.html
rename : content/media/webaudio/test/test_audioBufferSourceNode.html => content/media/webaudio/test/test_delayNodeWithGainAlternate.html
extra : rebase_source : 2cc9259229209fa926970e78ddfc2ef5765f4ad5
2013-05-13 00:17:55 -04:00

47 lines
1.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioBufferSourceNode.gain in presence of loops</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 4096,
numberOfChannels: 1,
createGraph: function(context) {
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
sourceBuffer.getChannelData(0)[i] = 1;
}
var source = context.createBufferSource();
source.buffer = sourceBuffer;
source.loop = true;
source.start(0);
source.stop(sourceBuffer.duration * 2);
// Adjust the gain in a way that we don't just end up modifying AudioChunk::mVolume
source.gain.setValueAtTime(0.5, 0);
return source;
},
createExpectedBuffers: function(context) {
var expectedBuffer = context.createBuffer(1, 4096, context.sampleRate);
for (var i = 0; i < 4096; ++i) {
expectedBuffer.getChannelData(0)[i] = 0.5;
}
return expectedBuffer;
},
};
runTest();
</script>
</pre>
</body>
</html>