Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (263198 => 263199)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-06-18 04:16:46 UTC (rev 263199)
@@ -1,3 +1,15 @@
+2020-06-17 Clark Wang <[email protected]>
+
+ Added missing orientation attributes to PannerNode
+ https://bugs.webkit.org/show_bug.cgi?id=213301
+
+ Reviewed by Chris Dumez.
+
+ Re-baselined previous tests that now have passing test cases.
+
+ * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic-expected.txt:
+
2020-06-17 Chris Dumez <[email protected]>
Add experimental feature flag for modern & unprefixed WebAudio API
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (263198 => 263199)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-06-18 04:16:46 UTC (rev 263199)
@@ -912,9 +912,9 @@
PASS PannerNode interface: attribute positionX
PASS PannerNode interface: attribute positionY
PASS PannerNode interface: attribute positionZ
-FAIL PannerNode interface: attribute orientationX assert_true: The prototype object must have a property "orientationX" expected true got false
-FAIL PannerNode interface: attribute orientationY assert_true: The prototype object must have a property "orientationY" expected true got false
-FAIL PannerNode interface: attribute orientationZ assert_true: The prototype object must have a property "orientationZ" expected true got false
+PASS PannerNode interface: attribute orientationX
+PASS PannerNode interface: attribute orientationY
+PASS PannerNode interface: attribute orientationZ
PASS PannerNode interface: attribute distanceModel
PASS PannerNode interface: attribute refDistance
PASS PannerNode interface: attribute maxDistance
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic-expected.txt (263198 => 263199)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic-expected.txt 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/pannernode-basic-expected.txt 2020-06-18 04:16:46 UTC (rev 263199)
@@ -1,7 +1,7 @@
PASS # AUDIT TASK RUNNER STARTED.
PASS Executing "initialize"
-FAIL Executing "basic" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'panner.orientationX.value')"
+PASS Executing "basic"
FAIL Executing "listener" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.listener.positionX.value')"
PASS Executing "panning models"
PASS Executing "distance models"
@@ -29,6 +29,10 @@
PASS panner.positionX is equal to 0.
PASS panner.positionY is equal to 0.
PASS panner.positionZ is equal to 0.
+PASS panner.orientationX is equal to 1.
+PASS panner.orientationY is equal to 0.
+PASS panner.orientationZ is equal to 0.
+FAIL < [basic] 1 out of 22 assertions were failed. assert_true: expected true got false
PASS > [listener]
PASS > [panning models]
PASS Set panner.panningModel = "equalpower" did not throw an exception.
Modified: trunk/Source/WebCore/ChangeLog (263198 => 263199)
--- trunk/Source/WebCore/ChangeLog 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/Source/WebCore/ChangeLog 2020-06-18 04:16:46 UTC (rev 263199)
@@ -1,3 +1,23 @@
+2020-06-17 Clark Wang <[email protected]>
+
+ Added missing orientation attributes to PannerNode
+ https://bugs.webkit.org/show_bug.cgi?id=213301
+
+ Reviewed by Chris Dumez.
+
+ Implemented orientation attributes in PannerNode interface, as per spec: https://www.w3.org/TR/webaudio/#pannernode.
+ Added FIXME comments for removing velocity later.
+
+ Re-baselined previous tests that now have passing test cases.
+
+ * Modules/webaudio/PannerNode.cpp:
+ (WebCore::PannerNode::PannerNode):
+ (WebCore::PannerNode::orientation const):
+ (WebCore::PannerNode::setOrientation):
+ (WebCore::PannerNode::distanceConeGain):
+ * Modules/webaudio/PannerNode.h:
+ * Modules/webaudio/PannerNode.idl:
+
2020-06-17 Chris Dumez <[email protected]>
Add experimental feature flag for modern & unprefixed WebAudio API
Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp (263198 => 263199)
--- trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp 2020-06-18 04:16:46 UTC (rev 263199)
@@ -60,6 +60,9 @@
, m_positionX(AudioParam::create(context, "positionX"_s, 0, -FLT_MAX, FLT_MAX))
, m_positionY(AudioParam::create(context, "positionY"_s, 0, -FLT_MAX, FLT_MAX))
, m_positionZ(AudioParam::create(context, "positionZ"_s, 0, -FLT_MAX, FLT_MAX))
+ , m_orientationX(AudioParam::create(context, "orientationX"_s, 1, -FLT_MAX, FLT_MAX))
+ , m_orientationY(AudioParam::create(context, "orientationY"_s, 0, -FLT_MAX, FLT_MAX))
+ , m_orientationZ(AudioParam::create(context, "orientationZ"_s, 0, -FLT_MAX, FLT_MAX))
, m_connectionCount(0)
{
setNodeType(NodeTypePanner);
@@ -78,7 +81,7 @@
m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);
- m_orientation = FloatPoint3D(1, 0, 0);
+ // FIXME: Remove velocity from PannerNode
m_velocity = FloatPoint3D(0, 0, 0);
initialize();
@@ -208,6 +211,18 @@
m_positionZ->setValue(z);
}
+FloatPoint3D PannerNode::orientation() const
+{
+ return FloatPoint3D(m_orientationX->value(), m_orientationY->value(), m_orientationZ->value());
+}
+
+void PannerNode::setOrientation(float x, float y, float z)
+{
+ m_orientationX->setValue(x);
+ m_orientationY->setValue(y);
+ m_orientationZ->setValue(z);
+}
+
DistanceModelType PannerNode::distanceModel() const
{
return const_cast<PannerNode*>(this)->m_distanceEffect.model();
@@ -341,7 +356,7 @@
m_distanceGain->setValue(static_cast<float>(distanceGain));
// FIXME: could optimize by caching coneGain
- double coneGain = m_coneEffect.gain(sourcePosition, m_orientation, listenerPosition);
+ double coneGain = m_coneEffect.gain(sourcePosition, orientation(), listenerPosition);
m_coneGain->setValue(static_cast<float>(coneGain));
Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.h (263198 => 263199)
--- trunk/Source/WebCore/Modules/webaudio/PannerNode.h 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.h 2020-06-18 04:16:46 UTC (rev 263199)
@@ -94,10 +94,13 @@
AudioParam& positionZ() { return m_positionZ.get(); }
// Orientation
- FloatPoint3D orientation() const { return m_orientation; }
- void setOrientation(float x, float y, float z) { m_orientation = FloatPoint3D(x, y, z); }
+ FloatPoint3D orientation() const;
+ void setOrientation(float x, float y, float z);
+ AudioParam& orientationX() { return m_orientationX.get(); }
+ AudioParam& orientationY() { return m_orientationY.get(); }
+ AudioParam& orientationZ() { return m_orientationZ.get(); }
- // Velocity
+ // FIXME: Remove velocity from PannerNode
FloatPoint3D velocity() const { return m_velocity; }
void setVelocity(float x, float y, float z) { m_velocity = FloatPoint3D(x, y, z); }
@@ -147,7 +150,7 @@
std::unique_ptr<Panner> m_panner;
PanningModelType m_panningModel;
- FloatPoint3D m_orientation;
+ // FIXME: Remove velocity from PannerNode
FloatPoint3D m_velocity;
// Gain
@@ -160,6 +163,10 @@
Ref<AudioParam> m_positionX;
Ref<AudioParam> m_positionY;
Ref<AudioParam> m_positionZ;
+
+ Ref<AudioParam> m_orientationX;
+ Ref<AudioParam> m_orientationY;
+ Ref<AudioParam> m_orientationZ;
// HRTF Database loader
RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader;
Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.idl (263198 => 263199)
--- trunk/Source/WebCore/Modules/webaudio/PannerNode.idl 2020-06-18 04:14:13 UTC (rev 263198)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.idl 2020-06-18 04:16:46 UTC (rev 263199)
@@ -27,15 +27,17 @@
JSGenerateToJSObject,
EnabledBySetting=ModernUnprefixedWebAudio,
] interface PannerNode : AudioNode {
- // Default model for stereo is HRTF
+ // Default model for stereo is equalpower
attribute PanningModelType panningModel;
// Uses a 3D cartesian coordinate system
void setPosition(unrestricted float x, unrestricted float y, unrestricted float z);
void setOrientation(unrestricted float x, unrestricted float y, unrestricted float z);
+
+ // FIXME: Remove velocity from PannerNode
void setVelocity(unrestricted float x, unrestricted float y, unrestricted float z);
- // Distance model
+ // Default distance model is inverse
attribute DistanceModelType distanceModel;
attribute unrestricted double refDistance;
@@ -51,4 +53,9 @@
readonly attribute AudioParam positionX;
readonly attribute AudioParam positionY;
readonly attribute AudioParam positionZ;
+
+ // Vector of direction of audio source in 3D cartesian system
+ readonly attribute AudioParam orientationX;
+ readonly attribute AudioParam orientationY;
+ readonly attribute AudioParam orientationZ;
};