mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 804387. Part 7.5: Make Web Audio tests context-rate-independent (disabling some decodeAudioData tests). r=ehsan
This commit is contained in:
parent
02d2c848e5
commit
36d8e43a3b
@ -12,13 +12,13 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
var ac = new AudioContext();
|
||||
var buffer = ac.createBuffer(2, 2048, 44100);
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(2, 2048, context.sampleRate);
|
||||
SpecialPowers.gc(); // Make sure that our channels are accessible after GC
|
||||
ok(buffer, "Buffer was allocated successfully");
|
||||
is(buffer.sampleRate, 44100, "Correct sample rate");
|
||||
is(buffer.sampleRate, context.sampleRate, "Correct sample rate");
|
||||
is(buffer.length, 2048, "Correct length");
|
||||
ok(Math.abs(buffer.duration - 2048 / 44100) < 0.0001, "Correct duration");
|
||||
ok(Math.abs(buffer.duration - 2048 / context.sampleRate) < 0.0001, "Correct duration");
|
||||
is(buffer.numberOfChannels, 2, "Correct number of channels");
|
||||
for (var i = 0; i < buffer.numberOfChannels; ++i) {
|
||||
var buf = buffer.getChannelData(i);
|
||||
|
@ -19,9 +19,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
@ -38,7 +38,7 @@ addLoadEvent(function() {
|
||||
// Verify default values
|
||||
is(filter.type, 0, "Correct default value for type");
|
||||
near(filter.frequency.minValue, 10, "Correct min value for filter frequency");
|
||||
near(filter.frequency.maxValue, 22050, "Correct max value for filter frequency");
|
||||
near(filter.frequency.maxValue, context.sampleRate/2, "Correct max value for filter frequency");
|
||||
near(filter.frequency.defaultValue, 350, "Correct default value for filter frequency");
|
||||
near(filter.Q.minValue, 0.001, "Correct min value for filter Q");
|
||||
near(filter.Q.maxValue, 1000, "Correct max value for filter Q");
|
||||
|
@ -254,8 +254,13 @@ expectTypeError(function() {
|
||||
cx.decodeAudioData(new Uint8Array(100), callbackShouldNeverRun, callbackShouldNeverRun);
|
||||
});
|
||||
|
||||
// Now, let's get real!
|
||||
runNextTest();
|
||||
if (cx.sampleRate == 44100) {
|
||||
// Now, let's get real!
|
||||
runNextTest();
|
||||
} else {
|
||||
todo(false, "Decoded data tests disabled; context sampleRate " + cx.sampleRate + " not supported");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -15,9 +15,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
|
@ -18,9 +18,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
|
@ -14,9 +14,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
|
@ -18,9 +18,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
|
@ -14,9 +14,9 @@ addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
|
||||
var context = new AudioContext();
|
||||
var buffer = context.createBuffer(1, 2048, 44100);
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var destination = context.destination;
|
||||
|
Loading…
Reference in New Issue
Block a user