Bug 1128494 - Change the default panning model of the PannerNode to "equalpower". r=smaug
authorPaul Adenot <paul@paul.cx>
Tue, 03 Feb 2015 11:25:37 +0100
changeset 227259 5636007e3d1a110bbce81f46b61cee5602249cc1
parent 227258 d220925b1467ca4731423663d46fab0493bb2ddf
child 227260 93c0418bd4b267ffa2c9e4ba5251c5b9a94c08c7
push id28225
push userryanvm@gmail.com
push dateTue, 03 Feb 2015 21:15:47 +0000
treeherdermozilla-central@0c2f7434c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1128494
milestone38.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 1128494 - Change the default panning model of the PannerNode to "equalpower". r=smaug
browser/devtools/webaudioeditor/test/head.js
dom/media/webaudio/PannerNode.cpp
dom/media/webaudio/test/test_pannerNode.html
dom/media/webaudio/test/test_pannerNodeHRTFSymmetry.html
dom/media/webaudio/test/test_pannerNodeTail.html
dom/webidl/PannerNode.webidl
--- a/browser/devtools/webaudioeditor/test/head.js
+++ b/browser/devtools/webaudioeditor/test/head.js
@@ -481,17 +481,17 @@ const NODE_DEFAULT_VALUES = {
     "detune": 0,
     "gain": 0
   },
   "WaveShaperNode": {
     "curve": null,
     "oversample": "none"
   },
   "PannerNode": {
-    "panningModel": "HRTF",
+    "panningModel": "equalpower",
     "distanceModel": "inverse",
     "refDistance": 1,
     "maxDistance": 10000,
     "rolloffFactor": 1,
     "coneInnerAngle": 360,
     "coneOuterAngle": 360,
     "coneOuterGain": 0
   },
--- a/dom/media/webaudio/PannerNode.cpp
+++ b/dom/media/webaudio/PannerNode.cpp
@@ -40,17 +40,17 @@ NS_IMPL_ADDREF_INHERITED(PannerNode, Aud
 NS_IMPL_RELEASE_INHERITED(PannerNode, AudioNode)
 
 class PannerNodeEngine : public AudioNodeEngine
 {
 public:
   explicit PannerNodeEngine(AudioNode* aNode)
     : AudioNodeEngine(aNode)
     // Please keep these default values consistent with PannerNode::PannerNode below.
-    , mPanningModelFunction(&PannerNodeEngine::HRTFPanningFunction)
+    , mPanningModelFunction(&PannerNodeEngine::EqualPowerPanningFunction)
     , mDistanceModelFunction(&PannerNodeEngine::InverseGainFunction)
     , mPosition()
     , mOrientation(1., 0., 0.)
     , mVelocity()
     , mRefDistance(1.)
     , mMaxDistance(10000.)
     , mRolloffFactor(1.)
     , mConeInnerAngle(360.)
@@ -223,17 +223,17 @@ public:
 };
 
 PannerNode::PannerNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Clamped_max,
               ChannelInterpretation::Speakers)
   // Please keep these default values consistent with PannerNodeEngine::PannerNodeEngine above.
-  , mPanningModel(PanningModelType::HRTF)
+  , mPanningModel(PanningModelType::Equalpower)
   , mDistanceModel(DistanceModelType::Inverse)
   , mPosition()
   , mOrientation(1., 0., 0.)
   , mVelocity()
   , mRefDistance(1.)
   , mMaxDistance(10000.)
   , mRolloffFactor(1.)
   , mConeInnerAngle(360.)
--- a/dom/media/webaudio/test/test_pannerNode.html
+++ b/dom/media/webaudio/test/test_pannerNode.html
@@ -28,17 +28,17 @@ addLoadEvent(function() {
   var panner = context.createPanner();
 
   source.buffer = buffer;
 
   source.connect(panner);
   panner.connect(destination);
 
   // Verify default values
-  is(panner.panningModel, "HRTF", "Correct default value for panning model");
+  is(panner.panningModel, "equalpower", "Correct default value for panning model");
   is(panner.distanceModel, "inverse", "Correct default value for distance model");
   near(panner.refDistance, 1, "Correct default value for ref distance");
   near(panner.maxDistance, 10000, "Correct default value for max distance");
   near(panner.rolloffFactor, 1, "Correct default value for rolloff factor");
   near(panner.coneInnerAngle, 360, "Correct default value for cone inner angle");
   near(panner.coneOuterAngle, 360, "Correct default value for cone outer angle");
   near(panner.coneOuterGain, 0, "Correct default value for cone outer gain");
   is(panner.channelCount, 2, "panner node has 2 input channels by default");
--- a/dom/media/webaudio/test/test_pannerNodeHRTFSymmetry.html
+++ b/dom/media/webaudio/test/test_pannerNodeHRTFSymmetry.html
@@ -24,16 +24,18 @@ function isChannelSilent(channel) {
     }
   }
   return true;
 }
 
 function startTest() {
   var leftPanner = ctx.createPanner();
   var rightPanner = ctx.createPanner();
+  leftPanner.type = "HRTF";
+  rightPanner.type = "HRTF";
   leftPanner.setPosition(-1,0,0);
   rightPanner.setPosition(1,0,0);
 
   // Test that PannerNode processes the signal consistently irrespective of
   // the offset in the processing block.  This is done by inserting a delay of
   // less than a block size before one panner.
   const delayTime = 0.7 * blockSize / ctx.sampleRate;
   var leftDelay = ctx.createDelay(delayTime);
--- a/dom/media/webaudio/test/test_pannerNodeTail.html
+++ b/dom/media/webaudio/test/test_pannerNodeTail.html
@@ -171,16 +171,17 @@ function startTest() {
 
   for (var i = 0; i < pannerCount; ++i) {
     var delay = ctx.createDelay(delayDuration);
     delay.delayTime.value = delayDuration;
     source.connect(delay);
     delay.connect(referencePanner)
 
     var panner = ctx.createPanner();
+    panner.type = "HRTF";
     delay.connect(panner);
     testPanners[i] = panner;
 
     delayDuration += blockSize / ctx.sampleRate;
   }
 
   // Create a ScriptProcessor now to use as a timer to trigger connection of
   // downstream nodes.  It will also be used to record reference output.
@@ -202,16 +203,17 @@ function prepareTest() {
   // Place the listener to the side of the origin, where the panners are
   // positioned, to maximize delay in one ear.
   ctx.listener.setPosition(1,0,0);
 
   // A PannerNode will produce no output until it has loaded its HRIR
   // database.  Wait for this to load before starting the test.
   var processor = ctx.createScriptProcessor(bufferSize, 2, 0);
   referencePanner = ctx.createPanner();
+  referencePanner.type = "HRTF";
   referencePanner.connect(processor);
   var oscillator = ctx.createOscillator();
   oscillator.connect(referencePanner);
   oscillator.start(0);
 
   processor.onaudioprocess = function(e) {
     if (isChannelSilent(e.inputBuffer.getChannelData(0)))
       return;
--- a/dom/webidl/PannerNode.webidl
+++ b/dom/webidl/PannerNode.webidl
@@ -18,31 +18,31 @@ enum PanningModelType {
 enum DistanceModelType {
   "linear",
   "inverse",
   "exponential"
 };
 
 interface PannerNode : AudioNode {
 
-    // Default for stereo is HRTF 
+    // Default for stereo is equalpower
     attribute PanningModelType panningModel;
 
-    // Uses a 3D cartesian coordinate system 
+    // Uses a 3D cartesian coordinate system
     void setPosition(double x, double y, double z);
     void setOrientation(double x, double y, double z);
     void setVelocity(double x, double y, double z);
 
-    // Distance model and attributes 
+    // Distance model and attributes
     attribute DistanceModelType distanceModel;
     attribute double refDistance;
     attribute double maxDistance;
     attribute double rolloffFactor;
 
-    // Directional sound cone 
+    // Directional sound cone
     attribute double coneInnerAngle;
     attribute double coneOuterAngle;
     attribute double coneOuterGain;
 
 };
 
 // Mozilla extension
 PannerNode implements AudioNodePassThrough;