Backed out changeset 85ec6c943147 (bug 867876)

This commit is contained in:
Ed Morley 2013-05-03 09:20:01 +01:00
parent 275a93e3f3
commit e9207d2323
4 changed files with 1 additions and 129 deletions

View File

@ -26,8 +26,6 @@ MOCHITEST_FILES := \
test_AudioContext.html \
test_AudioListener.html \
test_AudioParam.html \
test_audioParamExponentialRamp.html \
test_audioParamLinearRamp.html \
test_audioBufferSourceNode.html \
test_audioBufferSourceNodeLazyLoopParam.html \
test_audioBufferSourceNodeLoop.html \

View File

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioParam.exponentialRampToValue</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">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var context = new AudioContext();
var V0 = 0.1;
var V1 = 0.9;
var T0 = 0;
var T1 = 2048 / context.sampleRate;
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
sourceBuffer.getChannelData(0)[i] = 1;
}
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
var t = i / context.sampleRate;
expectedBuffer.getChannelData(0)[i] = V0 * Math.pow(V1 / V0, (t - T0) / (T1 - T0));
}
var destination = context.destination;
var source = context.createBufferSource();
source.buffer = sourceBuffer;
var gain = context.createGain();
gain.gain.setValueAtTime(V0, 0);
gain.gain.exponentialRampToValueAtTime(V1, 2048/context.sampleRate);
var sp = context.createScriptProcessor(2048, 1);
source.connect(gain);
gain.connect(sp);
sp.connect(destination);
source.start(0);
sp.onaudioprocess = function(e) {
is(e.inputBuffer.numberOfChannels, 1, "Correct input channel count");
compareBuffers(e.inputBuffer.getChannelData(0), expectedBuffer.getChannelData(0));
sp.onaudioprocess = null;
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
};
});
</script>
</pre>
</body>
</html>

View File

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioParam.linearRampToValue</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">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var context = new AudioContext();
var V0 = 0.1;
var V1 = 0.9;
var T0 = 0;
var T1 = 2048 / context.sampleRate;
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
sourceBuffer.getChannelData(0)[i] = 1;
}
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
var t = i / context.sampleRate;
expectedBuffer.getChannelData(0)[i] = V0 + (V1 - V0) * ((t - T0) / (T1 - T0));
}
var destination = context.destination;
var source = context.createBufferSource();
source.buffer = sourceBuffer;
var gain = context.createGain();
gain.gain.setValueAtTime(V0, 0);
gain.gain.linearRampToValueAtTime(V1, 2048/context.sampleRate);
var sp = context.createScriptProcessor(2048, 1);
source.connect(gain);
gain.connect(sp);
sp.connect(destination);
source.start(0);
sp.onaudioprocess = function(e) {
is(e.inputBuffer.numberOfChannels, 1, "Correct input channel count");
compareBuffers(e.inputBuffer.getChannelData(0), expectedBuffer.getChannelData(0));
sp.onaudioprocess = null;
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
};
});
</script>
</pre>
</body>
</html>

View File

@ -24,7 +24,7 @@ function expectTypeError(func) {
}
function fuzzyCompare(a, b) {
return Math.abs(a - b) < 9e-3;
return Math.abs(a - b) < 5e-5;
}
function compareBuffers(buf1, buf2,