Bug 1500238 correct expected result for monoPanningNoop tests r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 19 Oct 2018 09:25:18 +0000
changeset 442208 cc7ddb5861a8de34ad979db33ebb46ff1bbfd8c5
parent 442207 59b646e9e8990e8655568896885857c7fb0fc676
child 442209 17f777b161890b63b207c412549e4afc7129fa32
push id71396
push userktomlinson@mozilla.com
push dateFri, 19 Oct 2018 21:00:31 +0000
treeherderautoland@01b1f806550b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1500238
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1500238 correct expected result for monoPanningNoop tests r=padenot Differential Revision: https://phabricator.services.mozilla.com/D9210
dom/media/webaudio/test/test_stereoPannerNode.html
--- a/dom/media/webaudio/test/test_stereoPannerNode.html
+++ b/dom/media/webaudio/test/test_stereoPannerNode.html
@@ -90,39 +90,39 @@ function expectedBufferNoop(gain) {
                                          sampleRate: SR });
   for (var i = 0; i < BUF_SIZE; i++) {
     expectedBuffer.getChannelData(0)[i] = gain * sine(i);
     expectedBuffer.getChannelData(1)[i] = gain * sine(i);
   }
   return expectedBuffer;
 }
 
-function expectedBufferForStereo(gain) {
+function expectedBufferForStereo(panning, gain) {
   gain = gain || 1.0;
   var expectedBuffer = new AudioBuffer({ numberOfChannels: 2,
                                          length: BUF_SIZE,
                                          sampleRate: SR });
-  var gainPanning = gainForPanningStereoToStereo(PANNING);
+  var gainPanning = gainForPanningStereoToStereo(panning);
   gainPanning[0] *= gain;
   gainPanning[1] *= gain;
   for (var i = 0; i < BUF_SIZE; i++) {
     var values = [ sine(i), sine(i) ];
     var processed = applyStereoToStereoPanning(values[0], values[1], gainPanning, PANNING);
     expectedBuffer.getChannelData(0)[i] = processed[0];
     expectedBuffer.getChannelData(1)[i] = processed[1];
   }
   return expectedBuffer;
 }
 
-function expectedBufferForMono(gain) {
+function expectedBufferForMono(panning, gain) {
   gain = gain || 1.0;
   var expectedBuffer = new AudioBuffer({ numberOfChannels: 2,
                                          length: BUF_SIZE,
                                          sampleRate: SR });
-  var gainPanning = gainForPanningMonoToStereo(PANNING);
+  var gainPanning = gainForPanningMonoToStereo(panning);
   gainPanning[0] *= gain;
   gainPanning[1] *= gain;
   for (var i = 0; i < BUF_SIZE; i++) {
     var value = sine(i);
     var processed = applyMonoToStereoPanning(value, gainPanning);
     expectedBuffer.getChannelData(0)[i] = processed[0];
     expectedBuffer.getChannelData(1)[i] = processed[1];
   }
@@ -131,34 +131,34 @@ function expectedBufferForMono(gain) {
 
 // Actual test cases
 var tests = [
   function monoPanningNoop(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     monoSource.connect(panner);
     monoSource.buffer = monoBuffer;
     monoSource.start(0);
-    return expectedBufferNoop();
+    return expectedBufferForMono(0);
   },
   function stereoPanningNoop(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     stereoSource.connect(panner);
     stereoSource.buffer = stereoBuffer;
     stereoSource.start(0);
     return expectedBufferNoop();
   },
   function monoPanningNoopWithGain(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     monoSource.connect(gain);
     gain.connect(panner);
     monoSource.buffer = monoBuffer;
     monoSource.start(0);
-    return expectedBufferNoop(GAIN);
+    return expectedBufferForMono(0, GAIN);
   },
   function stereoPanningNoopWithGain(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     stereoSource.connect(gain);
     gain.connect(panner);
     stereoSource.buffer = stereoBuffer;
@@ -166,85 +166,85 @@ var tests = [
     return expectedBufferNoop(GAIN);
   },
   function stereoPanningAutomation(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     stereoSource.connect(panner);
     stereoSource.buffer = stereoBuffer;
     panner.pan.setValueAtTime(0.1, 0.0);
     stereoSource.start(0);
-    return expectedBufferForStereo();
+    return expectedBufferForStereo(PANNING);
   },
   function stereoPanning(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     stereoSource.buffer = stereoBuffer;
     stereoSource.connect(panner);
     panner.pan.value = 0.1;
     stereoSource.start(0);
-    return expectedBufferForStereo();
+    return expectedBufferForStereo(PANNING);
   },
   function monoPanningAutomation(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     monoSource.connect(panner);
     monoSource.buffer = monoBuffer;
     panner.pan.setValueAtTime(PANNING, 0.0);
     monoSource.start(0);
-    return expectedBufferForMono();
+    return expectedBufferForMono(PANNING);
   },
   function monoPanning(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     monoSource.connect(panner);
     monoSource.buffer = monoBuffer;
     panner.pan.value = 0.1;
     monoSource.start(0);
-    return expectedBufferForMono();
+    return expectedBufferForMono(PANNING);
   },
   function monoPanningWithGain(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     monoSource.connect(gain);
     gain.connect(panner);
     monoSource.buffer = monoBuffer;
     panner.pan.value = 0.1;
     monoSource.start(0);
-    return expectedBufferForMono(GAIN);
+    return expectedBufferForMono(PANNING, GAIN);
   },
   function stereoPanningWithGain(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     stereoSource.connect(gain);
     gain.connect(panner);
     stereoSource.buffer = stereoBuffer;
     panner.pan.value = 0.1;
     stereoSource.start(0);
-    return expectedBufferForStereo(GAIN);
+    return expectedBufferForStereo(PANNING, GAIN);
   },
   function monoPanningWithGainAndAutomation(ctx, panner) {
     var monoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     monoSource.connect(gain);
     gain.connect(panner);
     monoSource.buffer = monoBuffer;
     panner.pan.setValueAtTime(PANNING, 0);
     monoSource.start(0);
-    return expectedBufferForMono(GAIN);
+    return expectedBufferForMono(PANNING, GAIN);
   },
   function stereoPanningWithGainAndAutomation(ctx, panner) {
     var stereoSource = ctx.createBufferSource();
     var gain = ctx.createGain();
     gain.gain.value = GAIN;
     stereoSource.connect(gain);
     gain.connect(panner);
     stereoSource.buffer = stereoBuffer;
     panner.pan.setValueAtTime(PANNING, 0);
     stereoSource.start(0);
-    return expectedBufferForStereo(GAIN);
+    return expectedBufferForStereo(PANNING, GAIN);
   }
 ];
 
 var finished = 0;
 function finish() {
   if (++finished == tests.length) {
     SimpleTest.finish();
   }