+2012-03-22 Xingnan Wang <xingnan.wang@intel.com>
+
+ Use stereo AudioBuffer instead of RealtimeAnalyserNode in the layout test of stereo2mono-down-mixing
+ https://bugs.webkit.org/show_bug.cgi?id=81881
+
+ Reviewed by Chris Rogers.
+
+ * webaudio/stereo2mono-down-mixing.html:
+
2012-03-22 Emil A Eklund <eae@chromium.org>
Unreviewed test_expectations update for chromium.
var sampleRate = 44100.0;
var renderLengthSeconds = 0.1;
-var fftSize = 32;
var context;
var toneBuffer;
var bufferSource;
-var analyser;
function createDataBuffer(context, lengthInSeconds) {
- var audioBuffer = context.createBuffer(1, lengthInSeconds * sampleRate, sampleRate);
+ var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
var n = audioBuffer.length;
- var data = audioBuffer.getChannelData(0);
+ var data0 = audioBuffer.getChannelData(0);
+ var data1 = audioBuffer.getChannelData(1);
for (var i = 0; i < n; ++i) {
- data[i] = 1.0;
+ data0[i] = 1.0;
+ data1[i] = 1.0;
}
return audioBuffer;
window.jsTestIsAsync = true;
- // Create offline audio context.
+ // Create offline audio context, the destination is mono.
context = new webkitAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
- // Explicitly create a mono AudioContext so that the destination is mono.
+ // Create a stereo AudioBuffer.
toneBuffer = createDataBuffer(context, renderLengthSeconds);
bufferSource = context.createBufferSource();
bufferSource.buffer = toneBuffer;
- // We create an analyser here, because it has a hard-coded stereo output.
- analyser = context.createAnalyser();
- analyser.fftSize = fftSize;
-
- bufferSource.connect(analyser);
- analyser.connect(context.destination);
+ bufferSource.connect(context.destination);
bufferSource.noteOn(0);