Title: [264176] trunk
Revision
264176
Author
[email protected]
Date
2020-07-09 09:31:33 -0700 (Thu, 09 Jul 2020)

Log Message

Set Restrictions for channelCount, channelCountMode for PannerNode
https://bugs.webkit.org/show_bug.cgi?id=213992

Patch by Clark Wang <[email protected]> on 2020-07-09
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Re-baselined tests that now pass.

* web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt:

Source/WebCore:

Added setter methods to PannerNode that handle exceptions for channelCount, channelCountMode, according to spec:
https://www.w3.org/TR/webaudio/#dom-audionode-channelcount.
Moved ChannelCount, ChannelCountMode enums into their own files.

Re-baselined tests that now pass.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::AudioNode):
(WebCore::AudioNode::setChannelCount):
(WebCore::AudioNode::setChannelCountMode):
(WebCore::AudioNode::setChannelInterpretation):
(WebCore::AudioNode::channelCount): Deleted.
(WebCore::AudioNode::channelCountMode): Deleted.
(WebCore::AudioNode::channelInterpretation): Deleted.
* Modules/webaudio/AudioNode.h:
(WebCore::AudioNode::channelCount const):
(WebCore::AudioNode::channelCountMode const):
(WebCore::AudioNode::channelInterpretation const):
(WebCore::AudioNode::internalChannelCountMode const): Deleted.
(WebCore::AudioNode::internalChannelInterpretation const): Deleted.
* Modules/webaudio/AudioNode.idl:
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::numberOfChannels const):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
* Modules/webaudio/AudioNodeOptions.h:
* Modules/webaudio/AudioNodeOptions.idl:
* Modules/webaudio/ChannelCountMode.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
* Modules/webaudio/ChannelCountMode.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
* Modules/webaudio/ChannelInterpretation.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
* Modules/webaudio/ChannelInterpretation.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::ConvolverNode):
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::PannerNode):
(WebCore::PannerNode::create):
(WebCore::PannerNode::setChannelCount):
(WebCore::PannerNode::setChannelCountMode):
* Modules/webaudio/PannerNode.h:
* Modules/webaudio/WebKitAudioPannerNode.cpp:
(WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::copyFrom):
(WebCore::AudioBus::sumFrom):
* platform/audio/AudioBus.h:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (264175 => 264176)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-09 16:31:33 UTC (rev 264176)
@@ -1,3 +1,14 @@
+2020-07-09  Clark Wang  <[email protected]>
+
+        Set Restrictions for channelCount, channelCountMode for PannerNode
+        https://bugs.webkit.org/show_bug.cgi?id=213992
+
+        Reviewed by Chris Dumez.
+
+        Re-baselined tests that now pass.
+
+        * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt:
+
 2020-07-09  Chris Dumez  <[email protected]>
 
         Resync web-platform-tests/xhr from upstream

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt (264175 => 264176)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt	2020-07-09 16:31:33 UTC (rev 264176)
@@ -44,27 +44,27 @@
 PASS   new PannerNode(c, {"channelCount":0}) threw InvalidStateError: "The object is in an invalid state.". 
 PASS   node.channelCount = 0 threw InvalidStateError: "The object is in an invalid state.". 
 PASS   node.channelCount after setting to 0 is equal to 2. 
-FAIL X new PannerNode(c, {"channelCount":3}) did not throw an exception. assert_true: expected true got false
-FAIL X node.channelCount = 3 did not throw an exception. assert_true: expected true got false
-FAIL X node.channelCount after setting to 3 is not equal to 2. Got 3. assert_true: expected true got false
-PASS   new PannerNode(c, {"channelCount":99}) threw InvalidStateError: "The object is in an invalid state.". 
-PASS   node.channelCount = 99 threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new PannerNode(c, {"channelCount":3}) threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 
+PASS   node.channelCount = 3 threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 
+PASS   node.channelCount after setting to 3 is equal to 2. 
+PASS   new PannerNode(c, {"channelCount":99}) threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 
+PASS   node.channelCount = 99 threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 
 PASS   node.channelCount after setting to 99 is equal to 2. 
 PASS   node3 = new PannerNode(c, {"channelCountMode":"clamped-max"}) did not throw an exception. 
 PASS   node3.channelCountMode is equal to clamped-max. 
 PASS   node4 = new PannerNode(c, {"channelCountMode":"explicit"}) did not throw an exception. 
 PASS   node4.channelCountMode is equal to explicit. 
-FAIL X new PannerNode(c, {"channelCountMode":"max"}) did not throw an exception. assert_true: expected true got false
-FAIL X node.channelCountMode = max did not throw an exception. assert_true: expected true got false
-FAIL X node.channelCountMode after setting to max is not equal to clamped-max. Got max. assert_true: expected true got false
-FAIL X new PannerNode(c, " + JSON.stringify(options) + ") threw "InvalidStateError" instead of EcmaScript error TypeError. assert_true: expected true got false
-FAIL X node.channelCountMode = foobar incorrectly threw InvalidStateError: "The object is in an invalid state.". assert_true: expected true got false
+PASS   new PannerNode(c, {"channelCountMode":"max"}) threw NotSupportedError: "PannerNode's channelCountMode cannot be max". 
+PASS   node.channelCountMode = max threw NotSupportedError: "PannerNode's channelCountMode cannot be max". 
+PASS   node.channelCountMode after setting to max is equal to clamped-max. 
+PASS   new PannerNode(c, " + JSON.stringify(options) + ") threw TypeError: "Type error". 
+PASS   node.channelCountMode = foobar did not throw an exception. 
 PASS   node.channelCountMode after setting to foobar is equal to clamped-max. 
 PASS   node5 = new PannerNode(c, {"channelInterpretation":"speakers"}) did not throw an exception. 
 PASS   node5.channelInterpretation is equal to speakers. 
 PASS   node6 = new PannerNode(c, {"channelInterpretation":"discrete"}) did not throw an exception. 
 PASS   node6.channelInterpretation is equal to discrete. 
-FAIL X new PannerNode(c, {"channelInterpretation":"foobar"}) threw "InvalidStateError" instead of EcmaScript error TypeError. assert_true: expected true got false
+PASS   new PannerNode(c, {"channelInterpretation":"foobar"}) threw TypeError: "Type error". 
 PASS   new PannerNode(c, {"maxDistance":-1}) threw RangeError: "maxDistance cannot be set to a non-positive value". 
 PASS   node.maxDistance = -1 threw RangeError: "maxDistance cannot be set to a non-positive value". 
 PASS   node.maxDistance after setting to -1 is equal to 10000. 
@@ -91,7 +91,7 @@
 PASS   node9.coneOuterGain is equal to 0.5. 
 PASS   node9 = new PannerNode(c, {"coneOuterGain":1}) did not throw an exception. 
 PASS   node9.coneOuterGain is equal to 1. 
-FAIL < [test AudioNodeOptions] 9 out of 54 assertions were failed. assert_true: expected true got false
+PASS < [test AudioNodeOptions] All assertions passed. (total 54 assertions) 
 PASS > [constructor with options]  
 PASS   node = new PannerNode(c, {"panningModel":"HRTF","positionX":1.4142135623730951,"positionY":2.8284271247461903,"positionZ":4.242640687119286,"orientationX":-1.4142135623730951,"orientationY":-2.8284271247461903,"orientationZ":-4.242640687119286,"distanceModel":"linear","refDistance":3.141592653589793,"maxDistance":6.283185307179586,"rolloffFactor":9.42477796076938,"coneInnerAngle":12.566370614359172,"coneOuterAngle":15.707963267948966,"coneOuterGain":0.3141592653589793}) did not throw an exception. 
 PASS   node instanceof PannerNode is equal to true. 
@@ -113,5 +113,5 @@
 PASS   node.channelCountMode is equal to clamped-max. 
 PASS   node.channelInterpretation is equal to speakers. 
 PASS < [constructor with options] All assertions passed. (total 19 assertions) 
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 5 tasks were failed. assert_true: expected true got false
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/CMakeLists.txt (264175 => 264176)


--- trunk/Source/WebCore/CMakeLists.txt	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-07-09 16:31:33 UTC (rev 264176)
@@ -459,6 +459,8 @@
     Modules/webaudio/AudioProcessingEvent.idl
     Modules/webaudio/BaseAudioContext.idl
     Modules/webaudio/BiquadFilterNode.idl
+    Modules/webaudio/ChannelCountMode.idl
+    Modules/webaudio/ChannelInterpretation.idl
     Modules/webaudio/ChannelMergerNode.idl
     Modules/webaudio/ChannelSplitterNode.idl
     Modules/webaudio/ConvolverNode.idl

Modified: trunk/Source/WebCore/ChangeLog (264175 => 264176)


--- trunk/Source/WebCore/ChangeLog	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/ChangeLog	2020-07-09 16:31:33 UTC (rev 264176)
@@ -1,3 +1,65 @@
+2020-07-09  Clark Wang  <[email protected]>
+
+        Set Restrictions for channelCount, channelCountMode for PannerNode
+        https://bugs.webkit.org/show_bug.cgi?id=213992
+
+        Reviewed by Chris Dumez.
+
+        Added setter methods to PannerNode that handle exceptions for channelCount, channelCountMode, according to spec:
+        https://www.w3.org/TR/webaudio/#dom-audionode-channelcount.
+        Moved ChannelCount, ChannelCountMode enums into their own files.
+
+        Re-baselined tests that now pass.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webaudio/AudioNode.cpp:
+        (WebCore::AudioNode::AudioNode):
+        (WebCore::AudioNode::setChannelCount):
+        (WebCore::AudioNode::setChannelCountMode):
+        (WebCore::AudioNode::setChannelInterpretation):
+        (WebCore::AudioNode::channelCount): Deleted.
+        (WebCore::AudioNode::channelCountMode): Deleted.
+        (WebCore::AudioNode::channelInterpretation): Deleted.
+        * Modules/webaudio/AudioNode.h:
+        (WebCore::AudioNode::channelCount const):
+        (WebCore::AudioNode::channelCountMode const):
+        (WebCore::AudioNode::channelInterpretation const):
+        (WebCore::AudioNode::internalChannelCountMode const): Deleted.
+        (WebCore::AudioNode::internalChannelInterpretation const): Deleted.
+        * Modules/webaudio/AudioNode.idl:
+        * Modules/webaudio/AudioNodeInput.cpp:
+        (WebCore::AudioNodeInput::numberOfChannels const):
+        (WebCore::AudioNodeInput::bus):
+        (WebCore::AudioNodeInput::sumAllConnections):
+        (WebCore::AudioNodeInput::pull):
+        * Modules/webaudio/AudioNodeOptions.h:
+        * Modules/webaudio/AudioNodeOptions.idl:
+        * Modules/webaudio/ChannelCountMode.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
+        * Modules/webaudio/ChannelCountMode.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
+        * Modules/webaudio/ChannelInterpretation.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
+        * Modules/webaudio/ChannelInterpretation.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
+        * Modules/webaudio/ConvolverNode.cpp:
+        (WebCore::ConvolverNode::ConvolverNode):
+        * Modules/webaudio/DefaultAudioDestinationNode.cpp:
+        (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
+        * Modules/webaudio/PannerNode.cpp:
+        (WebCore::PannerNode::PannerNode):
+        (WebCore::PannerNode::create):
+        (WebCore::PannerNode::setChannelCount):
+        (WebCore::PannerNode::setChannelCountMode):
+        * Modules/webaudio/PannerNode.h:
+        * Modules/webaudio/WebKitAudioPannerNode.cpp:
+        (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode):
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/audio/AudioBus.cpp:
+        (WebCore::AudioBus::copyFrom):
+        (WebCore::AudioBus::sumFrom):
+        * platform/audio/AudioBus.h:
+
 2020-07-09  Alicia Boya GarcĂ­a  <[email protected]>
 
         [MSE][GStreamer] Remove m_appendPipelinesMap

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (264175 => 264176)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-07-09 16:31:33 UTC (rev 264176)
@@ -308,6 +308,8 @@
 $(PROJECT_DIR)/Modules/webaudio/AudioProcessingEvent.idl
 $(PROJECT_DIR)/Modules/webaudio/BaseAudioContext.idl
 $(PROJECT_DIR)/Modules/webaudio/BiquadFilterNode.idl
+$(PROJECT_DIR)/Modules/webaudio/ChannelCountMode.idl
+$(PROJECT_DIR)/Modules/webaudio/ChannelInterpretation.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelMergerNode.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelSplitterNode.idl
 $(PROJECT_DIR)/Modules/webaudio/ConvolverNode.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (264175 => 264176)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-07-09 16:31:33 UTC (rev 264176)
@@ -301,6 +301,10 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasTransform.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasUserInterface.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasUserInterface.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelCountMode.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelCountMode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelInterpretation.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelInterpretation.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelMergerNode.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelMergerNode.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelSplitterNode.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (264175 => 264176)


--- trunk/Source/WebCore/DerivedSources.make	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/DerivedSources.make	2020-07-09 16:31:33 UTC (rev 264176)
@@ -391,6 +391,8 @@
     $(WebCore)/Modules/webaudio/AudioProcessingEvent.idl \
     $(WebCore)/Modules/webaudio/BaseAudioContext.idl \
     $(WebCore)/Modules/webaudio/BiquadFilterNode.idl \
+    $(WebCore)/Modules/webaudio/ChannelCountMode.idl \
+    $(WebCore)/Modules/webaudio/ChannelInterpretation.idl \
     $(WebCore)/Modules/webaudio/ChannelMergerNode.idl \
     $(WebCore)/Modules/webaudio/ChannelSplitterNode.idl \
     $(WebCore)/Modules/webaudio/ConvolverNode.idl \

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -106,8 +106,8 @@
     , m_logIdentifier(context.nextAudioNodeLogIdentifier())
 #endif
     , m_channelCount(2)
-    , m_channelCountMode(Max)
-    , m_channelInterpretation(AudioBus::Speakers)
+    , m_channelCountMode(ChannelCountMode::Max)
+    , m_channelInterpretation(ChannelInterpretation::Speakers)
 {
     ALWAYS_LOG(LOGIDENTIFIER);
     
@@ -268,11 +268,6 @@
     return { };
 }
 
-unsigned AudioNode::channelCount()
-{
-    return m_channelCount;
-}
-
 ExceptionOr<void> AudioNode::setChannelCount(unsigned channelCount)
 {
     ASSERT(isMainThread());
@@ -287,27 +282,13 @@
         return { };
 
     m_channelCount = channelCount;
-    if (m_channelCountMode != Max)
+    if (m_channelCountMode != ChannelCountMode::Max)
         updateChannelsForInputs();
     return { };
 }
 
-String AudioNode::channelCountMode()
+ExceptionOr<void> AudioNode::setChannelCountMode(ChannelCountMode mode)
 {
-    switch (m_channelCountMode) {
-    case Max:
-        return "max"_s;
-    case ClampedMax:
-        return "clamped-max"_s;
-    case Explicit:
-        return "explicit"_s;
-    }
-    ASSERT_NOT_REACHED();
-    return emptyString();
-}
-
-ExceptionOr<void> AudioNode::setChannelCountMode(const String& mode)
-{
     ASSERT(isMainThread());
     BaseAudioContext::AutoLocker locker(context());
 
@@ -314,16 +295,8 @@
     ALWAYS_LOG(LOGIDENTIFIER, mode);
     
     ChannelCountMode oldMode = m_channelCountMode;
+    m_channelCountMode = mode;
 
-    if (mode == "max")
-        m_channelCountMode = Max;
-    else if (mode == "clamped-max")
-        m_channelCountMode = ClampedMax;
-    else if (mode == "explicit")
-        m_channelCountMode = Explicit;
-    else
-        return Exception { InvalidStateError };
-
     if (m_channelCountMode != oldMode)
         updateChannelsForInputs();
 
@@ -330,31 +303,14 @@
     return { };
 }
 
-String AudioNode::channelInterpretation()
+ExceptionOr<void> AudioNode::setChannelInterpretation(ChannelInterpretation interpretation)
 {
-    switch (m_channelInterpretation) {
-    case AudioBus::Speakers:
-        return "speakers"_s;
-    case AudioBus::Discrete:
-        return "discrete"_s;
-    }
-    ASSERT_NOT_REACHED();
-    return emptyString();
-}
-
-ExceptionOr<void> AudioNode::setChannelInterpretation(const String& interpretation)
-{
     ASSERT(isMainThread());
     BaseAudioContext::AutoLocker locker(context());
 
     ALWAYS_LOG(LOGIDENTIFIER, interpretation);
     
-    if (interpretation == "speakers")
-        m_channelInterpretation = AudioBus::Speakers;
-    else if (interpretation == "discrete")
-        m_channelInterpretation = AudioBus::Discrete;
-    else
-        return Exception { InvalidStateError };
+    m_channelInterpretation = interpretation;
 
     return { };
 }

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.h (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNode.h	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -25,6 +25,8 @@
 #pragma once
 
 #include "AudioBus.h"
+#include "ChannelCountMode.h"
+#include "ChannelInterpretation.h"
 #include "EventTarget.h"
 #include "ExceptionOr.h"
 #include <wtf/Forward.h>
@@ -92,12 +94,6 @@
         NodeTypeEnd
     };
 
-    enum ChannelCountMode {
-        Max,
-        ClampedMax,
-        Explicit
-    };
-
     NodeType nodeType() const { return m_nodeType; }
     void setNodeType(NodeType);
 
@@ -177,18 +173,15 @@
     void enableOutputsIfNecessary();
     void disableOutputsIfNecessary();
 
-    unsigned channelCount();
+    unsigned channelCount() const { return m_channelCount; }
     virtual ExceptionOr<void> setChannelCount(unsigned);
 
-    String channelCountMode();
-    ExceptionOr<void> setChannelCountMode(const String&);
+    ChannelCountMode channelCountMode() const { return m_channelCountMode; }
+    virtual ExceptionOr<void> setChannelCountMode(ChannelCountMode);
 
-    String channelInterpretation();
-    ExceptionOr<void> setChannelInterpretation(const String&);
+    ChannelInterpretation channelInterpretation() const { return m_channelInterpretation; }
+    ExceptionOr<void> setChannelInterpretation(ChannelInterpretation);
 
-    ChannelCountMode internalChannelCountMode() const { return m_channelCountMode; }
-    AudioBus::ChannelInterpretation internalChannelInterpretation() const { return m_channelInterpretation; }
-
 protected:
     // Inputs and outputs must be created before the AudioNode is initialized.
     void addInput(std::unique_ptr<AudioNodeInput>);
@@ -251,7 +244,7 @@
 protected:
     unsigned m_channelCount;
     ChannelCountMode m_channelCountMode;
-    AudioBus::ChannelInterpretation m_channelInterpretation;
+    ChannelInterpretation m_channelInterpretation;
 };
 
 String convertEnumerationToString(AudioNode::NodeType);

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.idl (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNode.idl	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.idl	2020-07-09 16:31:33 UTC (rev 264176)
@@ -30,8 +30,8 @@
     readonly attribute unsigned long numberOfOutputs;
 
     attribute unsigned long channelCount;
-    attribute DOMString channelCountMode;
-    attribute DOMString channelInterpretation;
+    attribute ChannelCountMode channelCountMode;
+    attribute ChannelInterpretation channelInterpretation;
 
     [MayThrowException] AudioNode connect([ReturnValue] AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0);
     [MayThrowException] void connect(AudioParam destination, optional unsigned long output = 0);

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -31,6 +31,7 @@
 #include "AudioContext.h"
 #include "AudioNode.h"
 #include "AudioNodeOutput.h"
+#include "ChannelCountMode.h"
 #include <algorithm>
 
 namespace WebCore {
@@ -144,8 +145,8 @@
 
 unsigned AudioNodeInput::numberOfChannels() const
 {
-    AudioNode::ChannelCountMode mode = node()->internalChannelCountMode();
-    if (mode == AudioNode::Explicit)
+    auto mode = node()->channelCountMode();
+    if (mode == ChannelCountMode::Explicit)
         return node()->channelCount();
 
     // Find the number of channels of the connection with the largest number of channels.
@@ -157,7 +158,7 @@
         maxChannels = std::max(maxChannels, output->numberOfChannels());
     }
 
-    if (mode == AudioNode::ClampedMax)
+    if (mode == ChannelCountMode::ClampedMax)
         maxChannels = std::min(maxChannels, static_cast<unsigned>(node()->channelCount()));
 
     return maxChannels;
@@ -168,7 +169,7 @@
     ASSERT(context().isAudioThread());
 
     // Handle single connection specially to allow for in-place processing.
-    if (numberOfRenderingConnections() == 1 && node()->internalChannelCountMode() == AudioNode::Max)
+    if (numberOfRenderingConnections() == 1 && node()->channelCountMode() == ChannelCountMode::Max)
         return renderingOutput(0)->bus();
 
     // Multiple connections case or complex ChannelCountMode (or no connections).
@@ -187,7 +188,7 @@
     ASSERT(context().isAudioThread());
 
     // We shouldn't be calling this method if there's only one connection, since it's less efficient.
-    ASSERT(numberOfRenderingConnections() > 1 || node()->internalChannelCountMode() != AudioNode::Max);
+    ASSERT(numberOfRenderingConnections() > 1 || node()->channelCountMode() != ChannelCountMode::Max);
 
     ASSERT(summingBus);
     if (!summingBus)
@@ -195,7 +196,7 @@
         
     summingBus->zero();
 
-    AudioBus::ChannelInterpretation interpretation = node()->internalChannelInterpretation();
+    auto interpretation = node()->channelInterpretation();
 
     for (auto& output : m_renderingOutputs) {
         ASSERT(output);
@@ -213,7 +214,7 @@
     ASSERT(context().isAudioThread());
 
     // Handle single connection case.
-    if (numberOfRenderingConnections() == 1 && node()->internalChannelCountMode() == AudioNode::Max) {
+    if (numberOfRenderingConnections() == 1 && node()->channelCountMode() == ChannelCountMode::Max) {
         // The output will optimize processing using inPlaceBus if it's able.
         AudioNodeOutput* output = this->renderingOutput(0);
         return output->pull(inPlaceBus, framesToProcess);

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -27,15 +27,16 @@
 
 #if ENABLE(WEB_AUDIO)
 
+#include "ChannelCountMode.h"
+#include "ChannelInterpretation.h"
 #include <wtf/Optional.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 struct AudioNodeOptions {
     Optional<unsigned> channelCount;
-    String channelCountMode;
-    String channelInterpretation;
+    Optional<ChannelCountMode> channelCountMode;
+    Optional<ChannelInterpretation> channelInterpretation;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl	2020-07-09 16:31:33 UTC (rev 264176)
@@ -26,10 +26,6 @@
     Conditional=WEB_AUDIO,
 ] dictionary AudioNodeOptions {
     unsigned long channelCount;
-    
-    // FIXME: Should be updated to use ChannelCountMode enum type.
-    DOMString channelCountMode;
-    
-    // FIXME: Should be updated to use ChannelInterpretation enum type.
-    DOMString channelInterpretation;
+    ChannelCountMode channelCountMode;
+    ChannelInterpretation channelInterpretation;
 };

Copied: trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.h (from rev 264175, trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h) (0 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class ChannelCountMode {
+    Max,
+    ClampedMax,
+    Explicit,
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.idl (from rev 264175, trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl) (0 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.idl	2020-07-09 16:31:33 UTC (rev 264176)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=WEB_AUDIO,
+] enum ChannelCountMode {
+    "max",
+    "clamped-max",
+    "explicit"
+};

Copied: trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.h (from rev 264175, trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h) (0 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "AudioBus.h"

Copied: trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.idl (from rev 264175, trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl) (0 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.idl	2020-07-09 16:31:33 UTC (rev 264176)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    Conditional=WEB_AUDIO,
+] enum ChannelInterpretation {
+    "speakers",
+    "discrete"
+};

Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -57,8 +57,8 @@
 
     // Node-specific default mixing rules.
     m_channelCount = 2;
-    m_channelCountMode = ClampedMax;
-    m_channelInterpretation = AudioBus::Speakers;
+    m_channelCountMode = ChannelCountMode::ClampedMax;
+    m_channelInterpretation = ChannelInterpretation::Speakers;
     
     initialize();
 }

Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -48,8 +48,8 @@
 {
     // Node-specific default mixing rules.
     m_channelCount = 2;
-    m_channelCountMode = Explicit;
-    m_channelInterpretation = AudioBus::Speakers;
+    m_channelCountMode = ChannelCountMode::Explicit;
+    m_channelInterpretation = ChannelInterpretation::Speakers;
 }
 
 DefaultAudioDestinationNode::~DefaultAudioDestinationNode()

Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -32,6 +32,7 @@
 #include "AudioContext.h"
 #include "AudioNodeInput.h"
 #include "AudioNodeOutput.h"
+#include "ChannelCountMode.h"
 #include "HRTFDatabaseLoader.h"
 #include "HRTFPanner.h"
 #include "ScriptExecutionContext.h"
@@ -75,8 +76,8 @@
 
     // Node-specific default mixing rules.
     m_channelCount = 2;
-    m_channelCountMode = ClampedMax;
-    m_channelInterpretation = AudioBus::Speakers;
+    m_channelCountMode = ChannelCountMode::ClampedMax;
+    m_channelInterpretation = ChannelInterpretation::Speakers;
 
     m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
     m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);
@@ -113,11 +114,11 @@
     if (result.hasException())
         return result.releaseException();
     
-    result = panner->setChannelCountMode(options.channelCountMode.isNull() ? "clamped-max"_str : options.channelCountMode);
+    result = panner->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::ClampedMax));
     if (result.hasException())
         return result.releaseException();
     
-    result = panner->setChannelInterpretation(options.channelInterpretation.isNull() ? "speakers"_str : options.channelInterpretation);
+    result = panner->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers));
     if (result.hasException())
         return result.releaseException();
     
@@ -335,6 +336,22 @@
     return { };
 }
 
+ExceptionOr<void> PannerNode::setChannelCount(unsigned channelCount)
+{
+    if (channelCount > 2)
+        return Exception { NotSupportedError, "PannerNode's channelCount cannot be greater than 2"_s };
+    
+    return AudioNode::setChannelCount(channelCount);
+}
+
+ExceptionOr<void> PannerNode::setChannelCountMode(ChannelCountMode mode)
+{
+    if (mode == ChannelCountMode::Max)
+        return Exception { NotSupportedError, "PannerNode's channelCountMode cannot be max"_s };
+    
+    return AudioNode::setChannelCountMode(mode);
+}
+
 void PannerNode::getAzimuthElevation(double* outAzimuth, double* outElevation)
 {
     // FIXME: we should cache azimuth and elevation (if possible), so we only re-calculate if a change has been made.

Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.h (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/PannerNode.h	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -127,6 +127,9 @@
 
     double coneOuterGain() const { return m_coneEffect.outerGain(); }
     ExceptionOr<void> setConeOuterGain(double);
+    
+    ExceptionOr<void> setChannelCount(unsigned) final;
+    ExceptionOr<void> setChannelCountMode(ChannelCountMode) final;
 
     void getAzimuthElevation(double* outAzimuth, double* outElevation);
     float dopplerRate() final;

Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp (264175 => 264176)


--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -64,8 +64,8 @@
 
     // Node-specific default mixing rules.
     m_channelCount = 2;
-    m_channelCountMode = ClampedMax;
-    m_channelInterpretation = AudioBus::Speakers;
+    m_channelCountMode = ChannelCountMode::ClampedMax;
+    m_channelInterpretation = ChannelInterpretation::Speakers;
 
     m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
     m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);

Modified: trunk/Source/WebCore/Sources.txt (264175 => 264176)


--- trunk/Source/WebCore/Sources.txt	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/Sources.txt	2020-07-09 16:31:33 UTC (rev 264176)
@@ -2701,6 +2701,8 @@
 JSCanvasTextDrawingStyles.cpp
 JSCanvasTransform.cpp
 JSCanvasUserInterface.cpp
+JSChannelCountMode.cpp
+JSChannelInterpretation.cpp
 JSChannelMergerNode.cpp
 JSChannelSplitterNode.cpp
 JSCharacterData.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (264175 => 264176)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-09 16:31:33 UTC (rev 264176)
@@ -5045,6 +5045,8 @@
 		E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E71467B324ABAEF200FB2F50 /* AudioNodeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B124ABAEF100FB2F50 /* AudioNodeOptions.h */; };
 		E71467B624ABAF1D00FB2F50 /* PannerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B524ABAF1D00FB2F50 /* PannerOptions.h */; };
+		E785D91524B4D1CA0014DB21 /* ChannelCountMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D91124B4D1B10014DB21 /* ChannelCountMode.h */; };
+		E785D93424B636FF0014DB21 /* ChannelInterpretation.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D93124B636FF0014DB21 /* ChannelInterpretation.h */; };
 		EBE5B226245A26EF003A5A88 /* SQLiteStatementAutoResetScope.h in Headers */ = {isa = PBXBuildFile; fileRef = EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */; };
 		EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF5121B1696496C0056BD25 /* JSTypeConversions.h */; };
@@ -15790,6 +15792,10 @@
 		E71467B424ABAF0B00FB2F50 /* AudioNodeOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AudioNodeOptions.idl; sourceTree = "<group>"; };
 		E71467B524ABAF1D00FB2F50 /* PannerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PannerOptions.h; sourceTree = "<group>"; };
 		E71467B724ABAF2C00FB2F50 /* PannerOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PannerOptions.idl; sourceTree = "<group>"; };
+		E785D91124B4D1B10014DB21 /* ChannelCountMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelCountMode.h; sourceTree = "<group>"; };
+		E785D91324B4D1B10014DB21 /* ChannelCountMode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelCountMode.idl; sourceTree = "<group>"; };
+		E785D93124B636FF0014DB21 /* ChannelInterpretation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelInterpretation.h; sourceTree = "<group>"; };
+		E785D93324B636FF0014DB21 /* ChannelInterpretation.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelInterpretation.idl; sourceTree = "<group>"; };
 		EB081CD81696084400553730 /* TypeConversions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeConversions.h; sourceTree = "<group>"; };
 		EB081CD91696084400553730 /* TypeConversions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypeConversions.idl; sourceTree = "<group>"; };
 		EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteStatementAutoResetScope.h; sourceTree = "<group>"; };
@@ -29370,6 +29376,10 @@
 				FDC54F031399B0DA008D9117 /* BiquadFilterNode.idl */,
 				FD315FDC12B0267600C1A359 /* BiquadProcessor.cpp */,
 				FD315FDD12B0267600C1A359 /* BiquadProcessor.h */,
+				E785D91124B4D1B10014DB21 /* ChannelCountMode.h */,
+				E785D91324B4D1B10014DB21 /* ChannelCountMode.idl */,
+				E785D93124B636FF0014DB21 /* ChannelInterpretation.h */,
+				E785D93324B636FF0014DB21 /* ChannelInterpretation.idl */,
 				FD315FB412B0267500C1A359 /* ChannelMergerNode.cpp */,
 				FD315FB512B0267500C1A359 /* ChannelMergerNode.h */,
 				FD315FB612B0267500C1A359 /* ChannelMergerNode.idl */,
@@ -30077,6 +30087,8 @@
 				91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */,
 				FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */,
 				97BC69DD1505F076001B74AC /* ChangeVersionWrapper.h in Headers */,
+				E785D91524B4D1CA0014DB21 /* ChannelCountMode.h in Headers */,
+				E785D93424B636FF0014DB21 /* ChannelInterpretation.h in Headers */,
 				FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */,
 				FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */,
 				6550B6A0099DF0270090D781 /* CharacterData.h in Headers */,

Modified: trunk/Source/WebCore/platform/audio/AudioBus.cpp (264175 => 264176)


--- trunk/Source/WebCore/platform/audio/AudioBus.cpp	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/platform/audio/AudioBus.cpp	2020-07-09 16:31:33 UTC (rev 264176)
@@ -253,10 +253,10 @@
             channel(i)->copyFrom(sourceBus.channel(i));
     } else {
         switch (channelInterpretation) {
-        case Speakers:
+        case ChannelInterpretation::Speakers:
             speakersCopyFrom(sourceBus);
             break;
-        case Discrete:
+        case ChannelInterpretation::Discrete:
             discreteCopyFrom(sourceBus);
             break;
         default:
@@ -278,10 +278,10 @@
             channel(i)->sumFrom(sourceBus.channel(i));
     } else {
         switch (channelInterpretation) {
-        case Speakers:
+        case ChannelInterpretation::Speakers:
             speakersSumFrom(sourceBus);
             break;
-        case Discrete:
+        case ChannelInterpretation::Discrete:
             discreteSumFrom(sourceBus);
             break;
         default:

Modified: trunk/Source/WebCore/platform/audio/AudioBus.h (264175 => 264176)


--- trunk/Source/WebCore/platform/audio/AudioBus.h	2020-07-09 16:22:59 UTC (rev 264175)
+++ trunk/Source/WebCore/platform/audio/AudioBus.h	2020-07-09 16:31:33 UTC (rev 264176)
@@ -40,6 +40,12 @@
 // An AudioBus represents a collection of one or more AudioChannels.
 // The data layout is "planar" as opposed to "interleaved".
 // An AudioBus with one channel is mono, an AudioBus with two channels is stereo, etc.
+
+enum class ChannelInterpretation {
+    Speakers,
+    Discrete,
+};
+
 class AudioBus final : public ThreadSafeRefCounted<AudioBus> {
     WTF_MAKE_NONCOPYABLE(AudioBus);
 public:
@@ -58,11 +64,6 @@
         // Can define non-standard layouts here
     };
 
-    enum ChannelInterpretation {
-        Speakers,
-        Discrete,
-    };
-
     // allocate indicates whether or not to initially have the AudioChannels created with managed storage.
     // Normal usage is to pass true here, in which case the AudioChannels will memory-manage their own storage.
     // If allocate is false then setChannelMemory() has to be called later on for each channel before the AudioBus is useable...
@@ -126,11 +127,11 @@
 
     // Copies the samples from the source bus to this one.
     // This is just a simple per-channel copy if the number of channels match, otherwise an up-mix or down-mix is done.
-    WEBCORE_EXPORT void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);
+    WEBCORE_EXPORT void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = ChannelInterpretation::Speakers);
 
     // Sums the samples from the source bus to this one.
     // This is just a simple per-channel summing if the number of channels match, otherwise an up-mix or down-mix is done.
-    void sumFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);
+    void sumFrom(const AudioBus& sourceBus, ChannelInterpretation = ChannelInterpretation::Speakers);
 
     // Copy each channel from sourceBus into our corresponding channel.
     // We scale by targetGain (and our own internal gain m_busGain), performing "de-zippering" to smoothly change from *lastMixGain to (targetGain*m_busGain).
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to