Commit a5ab21cc authored by hongchan@chromium.org's avatar hongchan@chromium.org

The HRTF panner uses significant memory for the responses and requires a fair...

The HRTF panner uses significant memory for the responses and requires a fair amount of processing to implement. For low-end mobile devices, this can be an issue. Since the default panner model is HRTF, the creation of the panner can cause the responses to be loaded.

Perhaps the default should be changed to equalpower, which doesn't consume significant memory and is much less intensive in processing power.

This is an incompatible change with the current spec.

See also: https://github.com/WebAudio/web-audio-api/issues/368

BUG=424356

Review URL: https://codereview.chromium.org/652073003

git-svn-id: svn://svn.chromium.org/blink/trunk@183925 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 070971c1
......@@ -16,7 +16,7 @@ PASS coneOuterAngle default value is 360.
PASS coneOuterAngle value is set to 166.66.
PASS coneOuterGain default value is 0.
PASS coneOuterGain value is set to 0.35.
PASS PannerNode defaults to 'HRTF' panningModel.
PASS PannerNode defaults to 'equalpower' panningModel.
PASS PannerNode defaults to 'inverse' distanceModel.
PASS panningModel: 'equalpower' is settable.
PASS panningModel: 'HRTF' is settable.
......
......@@ -20,18 +20,18 @@ function runTest() {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.jsTestIsAsync = true;
context = new AudioContext();
var panner = context.createPanner();
if (panner.numberOfInputs === 1)
if (panner.numberOfInputs === 1)
testPassed("PannerNode has one input.");
else
testFailed("PannerNode should have one input.");
if (panner.numberOfOutputs === 1)
if (panner.numberOfOutputs === 1)
testPassed("PannerNode has one output.");
else
testFailed("PannerNode should have one output.");
......@@ -40,57 +40,57 @@ function runTest() {
testPassed("refDistance default value is 1.");
else
testFailed("refDistance default value should be 1.");
panner.refDistance = 270.52
if (panner.refDistance === 270.52)
testPassed("refDistance value is set to 270.52.");
else
testFailed("refDistance value should be set to 270.52.");
if (panner.maxDistance === 10000)
testPassed("maxDistance default value is 10000.");
else
testFailed("maxDistance default value should be 10000.");
panner.maxDistance = 100.55
if (panner.maxDistance === 100.55)
testPassed("maxDistance value is set to 100.55.");
else
testFailed("maxDistance value should be set to 100.55.");
if (panner.rolloffFactor === 1)
testPassed("rolloffFactor default value is 1.");
else
testFailed("rolloffFactor default value should be 1.");
panner.rolloffFactor = 0.83
if (panner.rolloffFactor === 0.83)
testPassed("rolloffFactor value is set to 0.83.");
else
testFailed("rolloffFactor value should be set to 0.83.");
if (panner.coneInnerAngle === 360)
testPassed("coneInnerAngle default value is 360.");
else
testFailed("coneInnerAngle default value should be 360.");
panner.coneInnerAngle = 240.45
if (panner.coneInnerAngle === 240.45)
testPassed("coneInnerAngle value is set to 240.45.");
else
testFailed("coneInnerAngle value should be set to 240.45.");
if (panner.coneOuterAngle === 360)
testPassed("coneOuterAngle default value is 360.");
else
testFailed("coneOuterAngle default value should be 360.");
panner.coneOuterAngle = 166.66
if (panner.coneOuterAngle === 166.66)
testPassed("coneOuterAngle value is set to 166.66.");
else
testFailed("coneOuterAngle value should be set to 166.66.");
if (panner.coneOuterGain === 0)
testPassed("coneOuterGain default value is 0.");
else
......@@ -102,11 +102,11 @@ function runTest() {
else
testFailed("coneOuterGain value should be set to 0.35.");
if (panner.panningModel === "HRTF")
testPassed("PannerNode defaults to 'HRTF' panningModel.");
if (panner.panningModel === "equalpower")
testPassed("PannerNode defaults to 'equalpower' panningModel.");
else
testFailed("PannerNode should default to 'HRTF' panningModel.");
testFailed("PannerNode should default to 'equalpower' panningModel.");
if (panner.distanceModel === "inverse")
testPassed("PannerNode defaults to 'inverse' distanceModel.");
else
......
......@@ -48,7 +48,7 @@ static void fixNANs(double &x)
PannerNode::PannerNode(AudioContext* context, float sampleRate)
: AudioNode(context, sampleRate)
, m_panningModel(Panner::PanningModelHRTF)
, m_panningModel(Panner::PanningModelEqualPower)
, m_distanceModel(DistanceEffect::ModelInverse)
, m_position(0, 0, 0)
, m_orientation(1, 0, 0)
......@@ -198,7 +198,7 @@ String PannerNode::panningModel() const
return "HRTF";
default:
ASSERT_NOT_REACHED();
return "HRTF";
return "equalpower";
}
}
......
......@@ -37,7 +37,7 @@ enum DistanceModelType {
NoInterfaceObject,
Conditional=WEB_AUDIO
] interface PannerNode : AudioNode {
// Default model for stereo is HRTF
// Default model for stereo is equalpower.
attribute PanningModelType panningModel;
// Uses a 3D cartesian coordinate system
......@@ -56,4 +56,4 @@ enum DistanceModelType {
attribute double coneInnerAngle;
attribute double coneOuterAngle;
attribute double coneOuterGain;
};
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment