Changeset 264176 in webkit
- Timestamp:
- Jul 9, 2020, 9:31:33 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
- 4 copied
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt (modified) (5 diffs)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioNode.cpp (modified) (6 diffs)
-
Source/WebCore/Modules/webaudio/AudioNode.h (modified) (4 diffs)
-
Source/WebCore/Modules/webaudio/AudioNode.idl (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioNodeInput.cpp (modified) (7 diffs)
-
Source/WebCore/Modules/webaudio/AudioNodeOptions.h (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/AudioNodeOptions.idl (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelCountMode.h (copied) (copied from trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h ) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelCountMode.idl (copied) (copied from trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl ) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelInterpretation.h (copied) (copied from trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h ) (1 diff)
-
Source/WebCore/Modules/webaudio/ChannelInterpretation.idl (copied) (copied from trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl ) (1 diff)
-
Source/WebCore/Modules/webaudio/ConvolverNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/PannerNode.cpp (modified) (4 diffs)
-
Source/WebCore/Modules/webaudio/PannerNode.h (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebCore/platform/audio/AudioBus.cpp (modified) (2 diffs)
-
Source/WebCore/platform/audio/AudioBus.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r264174 r264176 1 2020-07-09 Clark Wang <clark_wang@apple.com> 2 3 Set Restrictions for channelCount, channelCountMode for PannerNode 4 https://bugs.webkit.org/show_bug.cgi?id=213992 5 6 Reviewed by Chris Dumez. 7 8 Re-baselined tests that now pass. 9 10 * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt: 11 1 12 2020-07-09 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt
r263985 r264176 45 45 PASS node.channelCount = 0 threw InvalidStateError: "The object is in an invalid state.". 46 46 PASS node.channelCount after setting to 0 is equal to 2. 47 FAIL X new PannerNode(c, {"channelCount":3}) did not throw an exception. assert_true: expected true got false 48 FAIL X node.channelCount = 3 did not throw an exception. assert_true: expected true got false 49 FAIL X node.channelCount after setting to 3 is not equal to 2. Got 3. assert_true: expected true got false 50 PASS new PannerNode(c, {"channelCount":99}) threw InvalidStateError: "The object is in an invalid state.".51 PASS node.channelCount = 99 threw InvalidStateError: "The object is in an invalid state.".47 PASS new PannerNode(c, {"channelCount":3}) threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 48 PASS node.channelCount = 3 threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 49 PASS node.channelCount after setting to 3 is equal to 2. 50 PASS new PannerNode(c, {"channelCount":99}) threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 51 PASS node.channelCount = 99 threw NotSupportedError: "PannerNode's channelCount cannot be greater than 2". 52 52 PASS node.channelCount after setting to 99 is equal to 2. 53 53 PASS node3 = new PannerNode(c, {"channelCountMode":"clamped-max"}) did not throw an exception. … … 55 55 PASS node4 = new PannerNode(c, {"channelCountMode":"explicit"}) did not throw an exception. 56 56 PASS node4.channelCountMode is equal to explicit. 57 FAIL X new PannerNode(c, {"channelCountMode":"max"}) did not throw an exception. assert_true: expected true got false 58 FAIL X node.channelCountMode = max did not throw an exception. assert_true: expected true got false 59 FAIL X node.channelCountMode after setting to max is not equal to clamped-max. Got max. assert_true: expected true got false 60 FAIL X new PannerNode(c, " + JSON.stringify(options) + ") threw "InvalidStateError" instead of EcmaScript error TypeError. assert_true: expected true got false 61 FAIL X node.channelCountMode = foobar incorrectly threw InvalidStateError: "The object is in an invalid state.". assert_true: expected true got false 57 PASS new PannerNode(c, {"channelCountMode":"max"}) threw NotSupportedError: "PannerNode's channelCountMode cannot be max". 58 PASS node.channelCountMode = max threw NotSupportedError: "PannerNode's channelCountMode cannot be max". 59 PASS node.channelCountMode after setting to max is equal to clamped-max. 60 PASS new PannerNode(c, " + JSON.stringify(options) + ") threw TypeError: "Type error". 61 PASS node.channelCountMode = foobar did not throw an exception. 62 62 PASS node.channelCountMode after setting to foobar is equal to clamped-max. 63 63 PASS node5 = new PannerNode(c, {"channelInterpretation":"speakers"}) did not throw an exception. … … 65 65 PASS node6 = new PannerNode(c, {"channelInterpretation":"discrete"}) did not throw an exception. 66 66 PASS node6.channelInterpretation is equal to discrete. 67 FAIL X new PannerNode(c, {"channelInterpretation":"foobar"}) threw "InvalidStateError" instead of EcmaScript error TypeError. assert_true: expected true got false 67 PASS new PannerNode(c, {"channelInterpretation":"foobar"}) threw TypeError: "Type error". 68 68 PASS new PannerNode(c, {"maxDistance":-1}) threw RangeError: "maxDistance cannot be set to a non-positive value". 69 69 PASS node.maxDistance = -1 threw RangeError: "maxDistance cannot be set to a non-positive value". … … 92 92 PASS node9 = new PannerNode(c, {"coneOuterGain":1}) did not throw an exception. 93 93 PASS node9.coneOuterGain is equal to 1. 94 FAIL < [test AudioNodeOptions] 9 out of 54 assertions were failed. assert_true: expected true got false 94 PASS < [test AudioNodeOptions] All assertions passed. (total 54 assertions) 95 95 PASS > [constructor with options] 96 96 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. … … 114 114 PASS node.channelInterpretation is equal to speakers. 115 115 PASS < [constructor with options] All assertions passed. (total 19 assertions) 116 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 5 tasks were failed. assert_true: expected true got false 116 PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully. 117 117 -
trunk/Source/WebCore/CMakeLists.txt
r263985 r264176 460 460 Modules/webaudio/BaseAudioContext.idl 461 461 Modules/webaudio/BiquadFilterNode.idl 462 Modules/webaudio/ChannelCountMode.idl 463 Modules/webaudio/ChannelInterpretation.idl 462 464 Modules/webaudio/ChannelMergerNode.idl 463 465 Modules/webaudio/ChannelSplitterNode.idl -
trunk/Source/WebCore/ChangeLog
r264175 r264176 1 2020-07-09 Clark Wang <clark_wang@apple.com> 2 3 Set Restrictions for channelCount, channelCountMode for PannerNode 4 https://bugs.webkit.org/show_bug.cgi?id=213992 5 6 Reviewed by Chris Dumez. 7 8 Added setter methods to PannerNode that handle exceptions for channelCount, channelCountMode, according to spec: 9 https://www.w3.org/TR/webaudio/#dom-audionode-channelcount. 10 Moved ChannelCount, ChannelCountMode enums into their own files. 11 12 Re-baselined tests that now pass. 13 14 * CMakeLists.txt: 15 * DerivedSources-input.xcfilelist: 16 * DerivedSources-output.xcfilelist: 17 * DerivedSources.make: 18 * Modules/webaudio/AudioNode.cpp: 19 (WebCore::AudioNode::AudioNode): 20 (WebCore::AudioNode::setChannelCount): 21 (WebCore::AudioNode::setChannelCountMode): 22 (WebCore::AudioNode::setChannelInterpretation): 23 (WebCore::AudioNode::channelCount): Deleted. 24 (WebCore::AudioNode::channelCountMode): Deleted. 25 (WebCore::AudioNode::channelInterpretation): Deleted. 26 * Modules/webaudio/AudioNode.h: 27 (WebCore::AudioNode::channelCount const): 28 (WebCore::AudioNode::channelCountMode const): 29 (WebCore::AudioNode::channelInterpretation const): 30 (WebCore::AudioNode::internalChannelCountMode const): Deleted. 31 (WebCore::AudioNode::internalChannelInterpretation const): Deleted. 32 * Modules/webaudio/AudioNode.idl: 33 * Modules/webaudio/AudioNodeInput.cpp: 34 (WebCore::AudioNodeInput::numberOfChannels const): 35 (WebCore::AudioNodeInput::bus): 36 (WebCore::AudioNodeInput::sumAllConnections): 37 (WebCore::AudioNodeInput::pull): 38 * Modules/webaudio/AudioNodeOptions.h: 39 * Modules/webaudio/AudioNodeOptions.idl: 40 * Modules/webaudio/ChannelCountMode.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h. 41 * Modules/webaudio/ChannelCountMode.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl. 42 * Modules/webaudio/ChannelInterpretation.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h. 43 * Modules/webaudio/ChannelInterpretation.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl. 44 * Modules/webaudio/ConvolverNode.cpp: 45 (WebCore::ConvolverNode::ConvolverNode): 46 * Modules/webaudio/DefaultAudioDestinationNode.cpp: 47 (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): 48 * Modules/webaudio/PannerNode.cpp: 49 (WebCore::PannerNode::PannerNode): 50 (WebCore::PannerNode::create): 51 (WebCore::PannerNode::setChannelCount): 52 (WebCore::PannerNode::setChannelCountMode): 53 * Modules/webaudio/PannerNode.h: 54 * Modules/webaudio/WebKitAudioPannerNode.cpp: 55 (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): 56 * Sources.txt: 57 * WebCore.xcodeproj/project.pbxproj: 58 * platform/audio/AudioBus.cpp: 59 (WebCore::AudioBus::copyFrom): 60 (WebCore::AudioBus::sumFrom): 61 * platform/audio/AudioBus.h: 62 1 63 2020-07-09 Alicia Boya García <aboya@igalia.com> 2 64 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r263985 r264176 309 309 $(PROJECT_DIR)/Modules/webaudio/BaseAudioContext.idl 310 310 $(PROJECT_DIR)/Modules/webaudio/BiquadFilterNode.idl 311 $(PROJECT_DIR)/Modules/webaudio/ChannelCountMode.idl 312 $(PROJECT_DIR)/Modules/webaudio/ChannelInterpretation.idl 311 313 $(PROJECT_DIR)/Modules/webaudio/ChannelMergerNode.idl 312 314 $(PROJECT_DIR)/Modules/webaudio/ChannelSplitterNode.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r263985 r264176 302 302 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasUserInterface.cpp 303 303 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasUserInterface.h 304 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelCountMode.cpp 305 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelCountMode.h 306 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelInterpretation.cpp 307 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelInterpretation.h 304 308 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelMergerNode.cpp 305 309 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSChannelMergerNode.h -
trunk/Source/WebCore/DerivedSources.make
r263985 r264176 392 392 $(WebCore)/Modules/webaudio/BaseAudioContext.idl \ 393 393 $(WebCore)/Modules/webaudio/BiquadFilterNode.idl \ 394 $(WebCore)/Modules/webaudio/ChannelCountMode.idl \ 395 $(WebCore)/Modules/webaudio/ChannelInterpretation.idl \ 394 396 $(WebCore)/Modules/webaudio/ChannelMergerNode.idl \ 395 397 $(WebCore)/Modules/webaudio/ChannelSplitterNode.idl \ -
trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp
r263985 r264176 107 107 #endif 108 108 , m_channelCount(2) 109 , m_channelCountMode( Max)110 , m_channelInterpretation( AudioBus::Speakers)109 , m_channelCountMode(ChannelCountMode::Max) 110 , m_channelInterpretation(ChannelInterpretation::Speakers) 111 111 { 112 112 ALWAYS_LOG(LOGIDENTIFIER); … … 269 269 } 270 270 271 unsigned AudioNode::channelCount()272 {273 return m_channelCount;274 }275 276 271 ExceptionOr<void> AudioNode::setChannelCount(unsigned channelCount) 277 272 { … … 288 283 289 284 m_channelCount = channelCount; 290 if (m_channelCountMode != Max)285 if (m_channelCountMode != ChannelCountMode::Max) 291 286 updateChannelsForInputs(); 292 287 return { }; 293 288 } 294 289 295 String AudioNode::channelCountMode() 296 { 297 switch (m_channelCountMode) { 298 case Max: 299 return "max"_s; 300 case ClampedMax: 301 return "clamped-max"_s; 302 case Explicit: 303 return "explicit"_s; 304 } 305 ASSERT_NOT_REACHED(); 306 return emptyString(); 307 } 308 309 ExceptionOr<void> AudioNode::setChannelCountMode(const String& mode) 290 ExceptionOr<void> AudioNode::setChannelCountMode(ChannelCountMode mode) 310 291 { 311 292 ASSERT(isMainThread()); … … 315 296 316 297 ChannelCountMode oldMode = m_channelCountMode; 317 318 if (mode == "max") 319 m_channelCountMode = Max; 320 else if (mode == "clamped-max") 321 m_channelCountMode = ClampedMax; 322 else if (mode == "explicit") 323 m_channelCountMode = Explicit; 324 else 325 return Exception { InvalidStateError }; 298 m_channelCountMode = mode; 326 299 327 300 if (m_channelCountMode != oldMode) … … 331 304 } 332 305 333 String AudioNode::channelInterpretation() 334 { 335 switch (m_channelInterpretation) { 336 case AudioBus::Speakers: 337 return "speakers"_s; 338 case AudioBus::Discrete: 339 return "discrete"_s; 340 } 341 ASSERT_NOT_REACHED(); 342 return emptyString(); 343 } 344 345 ExceptionOr<void> AudioNode::setChannelInterpretation(const String& interpretation) 306 ExceptionOr<void> AudioNode::setChannelInterpretation(ChannelInterpretation interpretation) 346 307 { 347 308 ASSERT(isMainThread()); … … 350 311 ALWAYS_LOG(LOGIDENTIFIER, interpretation); 351 312 352 if (interpretation == "speakers") 353 m_channelInterpretation = AudioBus::Speakers; 354 else if (interpretation == "discrete") 355 m_channelInterpretation = AudioBus::Discrete; 356 else 357 return Exception { InvalidStateError }; 313 m_channelInterpretation = interpretation; 358 314 359 315 return { }; -
trunk/Source/WebCore/Modules/webaudio/AudioNode.h
r263985 r264176 26 26 27 27 #include "AudioBus.h" 28 #include "ChannelCountMode.h" 29 #include "ChannelInterpretation.h" 28 30 #include "EventTarget.h" 29 31 #include "ExceptionOr.h" … … 93 95 }; 94 96 95 enum ChannelCountMode {96 Max,97 ClampedMax,98 Explicit99 };100 101 97 NodeType nodeType() const { return m_nodeType; } 102 98 void setNodeType(NodeType); … … 178 174 void disableOutputsIfNecessary(); 179 175 180 unsigned channelCount() ;176 unsigned channelCount() const { return m_channelCount; } 181 177 virtual ExceptionOr<void> setChannelCount(unsigned); 182 178 183 String channelCountMode(); 184 ExceptionOr<void> setChannelCountMode(const String&); 185 186 String channelInterpretation(); 187 ExceptionOr<void> setChannelInterpretation(const String&); 188 189 ChannelCountMode internalChannelCountMode() const { return m_channelCountMode; } 190 AudioBus::ChannelInterpretation internalChannelInterpretation() const { return m_channelInterpretation; } 179 ChannelCountMode channelCountMode() const { return m_channelCountMode; } 180 virtual ExceptionOr<void> setChannelCountMode(ChannelCountMode); 181 182 ChannelInterpretation channelInterpretation() const { return m_channelInterpretation; } 183 ExceptionOr<void> setChannelInterpretation(ChannelInterpretation); 191 184 192 185 protected: … … 252 245 unsigned m_channelCount; 253 246 ChannelCountMode m_channelCountMode; 254 AudioBus::ChannelInterpretation m_channelInterpretation;247 ChannelInterpretation m_channelInterpretation; 255 248 }; 256 249 -
trunk/Source/WebCore/Modules/webaudio/AudioNode.idl
r263381 r264176 31 31 32 32 attribute unsigned long channelCount; 33 attribute DOMStringchannelCountMode;34 attribute DOMStringchannelInterpretation;33 attribute ChannelCountMode channelCountMode; 34 attribute ChannelInterpretation channelInterpretation; 35 35 36 36 [MayThrowException] AudioNode connect([ReturnValue] AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0); -
trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp
r196603 r264176 32 32 #include "AudioNode.h" 33 33 #include "AudioNodeOutput.h" 34 #include "ChannelCountMode.h" 34 35 #include <algorithm> 35 36 … … 145 146 unsigned AudioNodeInput::numberOfChannels() const 146 147 { 147 AudioNode::ChannelCountMode mode = node()->internalChannelCountMode();148 if (mode == AudioNode::Explicit)148 auto mode = node()->channelCountMode(); 149 if (mode == ChannelCountMode::Explicit) 149 150 return node()->channelCount(); 150 151 … … 158 159 } 159 160 160 if (mode == AudioNode::ClampedMax)161 if (mode == ChannelCountMode::ClampedMax) 161 162 maxChannels = std::min(maxChannels, static_cast<unsigned>(node()->channelCount())); 162 163 … … 169 170 170 171 // Handle single connection specially to allow for in-place processing. 171 if (numberOfRenderingConnections() == 1 && node()-> internalChannelCountMode() == AudioNode::Max)172 if (numberOfRenderingConnections() == 1 && node()->channelCountMode() == ChannelCountMode::Max) 172 173 return renderingOutput(0)->bus(); 173 174 … … 188 189 189 190 // We shouldn't be calling this method if there's only one connection, since it's less efficient. 190 ASSERT(numberOfRenderingConnections() > 1 || node()-> internalChannelCountMode() != AudioNode::Max);191 ASSERT(numberOfRenderingConnections() > 1 || node()->channelCountMode() != ChannelCountMode::Max); 191 192 192 193 ASSERT(summingBus); … … 196 197 summingBus->zero(); 197 198 198 AudioBus::ChannelInterpretation interpretation = node()->internalChannelInterpretation();199 auto interpretation = node()->channelInterpretation(); 199 200 200 201 for (auto& output : m_renderingOutputs) { … … 214 215 215 216 // Handle single connection case. 216 if (numberOfRenderingConnections() == 1 && node()-> internalChannelCountMode() == AudioNode::Max) {217 if (numberOfRenderingConnections() == 1 && node()->channelCountMode() == ChannelCountMode::Max) { 217 218 // The output will optimize processing using inPlaceBus if it's able. 218 219 AudioNodeOutput* output = this->renderingOutput(0); -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.h
r263985 r264176 28 28 #if ENABLE(WEB_AUDIO) 29 29 30 #include "ChannelCountMode.h" 31 #include "ChannelInterpretation.h" 30 32 #include <wtf/Optional.h> 31 #include <wtf/text/WTFString.h>32 33 33 34 namespace WebCore { … … 35 36 struct AudioNodeOptions { 36 37 Optional<unsigned> channelCount; 37 StringchannelCountMode;38 StringchannelInterpretation;38 Optional<ChannelCountMode> channelCountMode; 39 Optional<ChannelInterpretation> channelInterpretation; 39 40 }; 40 41 -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOptions.idl
r263985 r264176 27 27 ] dictionary AudioNodeOptions { 28 28 unsigned long channelCount; 29 30 // FIXME: Should be updated to use ChannelCountMode enum type. 31 DOMString channelCountMode; 32 33 // FIXME: Should be updated to use ChannelInterpretation enum type. 34 DOMString channelInterpretation; 29 ChannelCountMode channelCountMode; 30 ChannelInterpretation channelInterpretation; 35 31 }; -
trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.h
r264175 r264176 26 26 #pragma once 27 27 28 #if ENABLE(WEB_AUDIO)29 30 #include <wtf/Optional.h>31 #include <wtf/text/WTFString.h>32 33 28 namespace WebCore { 34 29 35 struct AudioNodeOptions{36 Optional<unsigned> channelCount;37 String channelCountMode;38 String channelInterpretation;30 enum class ChannelCountMode { 31 Max, 32 ClampedMax, 33 Explicit, 39 34 }; 40 35 41 36 } // namespace WebCore 42 43 #endif // ENABLE(WEB_AUDIO) -
trunk/Source/WebCore/Modules/webaudio/ChannelCountMode.idl
r264175 r264176 25 25 [ 26 26 Conditional=WEB_AUDIO, 27 ] dictionary AudioNodeOptions { 28 unsigned long channelCount; 29 30 // FIXME: Should be updated to use ChannelCountMode enum type. 31 DOMString channelCountMode; 32 33 // FIXME: Should be updated to use ChannelInterpretation enum type. 34 DOMString channelInterpretation; 27 ] enum ChannelCountMode { 28 "max", 29 "clamped-max", 30 "explicit" 35 31 }; -
trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.h
r264175 r264176 26 26 #pragma once 27 27 28 #if ENABLE(WEB_AUDIO) 29 30 #include <wtf/Optional.h> 31 #include <wtf/text/WTFString.h> 32 33 namespace WebCore { 34 35 struct AudioNodeOptions { 36 Optional<unsigned> channelCount; 37 String channelCountMode; 38 String channelInterpretation; 39 }; 40 41 } // namespace WebCore 42 43 #endif // ENABLE(WEB_AUDIO) 28 #include "AudioBus.h" -
trunk/Source/WebCore/Modules/webaudio/ChannelInterpretation.idl
r264175 r264176 25 25 [ 26 26 Conditional=WEB_AUDIO, 27 ] dictionary AudioNodeOptions { 28 unsigned long channelCount; 29 30 // FIXME: Should be updated to use ChannelCountMode enum type. 31 DOMString channelCountMode; 32 33 // FIXME: Should be updated to use ChannelInterpretation enum type. 34 DOMString channelInterpretation; 27 ] enum ChannelInterpretation { 28 "speakers", 29 "discrete" 35 30 }; -
trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp
r263410 r264176 58 58 // Node-specific default mixing rules. 59 59 m_channelCount = 2; 60 m_channelCountMode = C lampedMax;61 m_channelInterpretation = AudioBus::Speakers;60 m_channelCountMode = ChannelCountMode::ClampedMax; 61 m_channelInterpretation = ChannelInterpretation::Speakers; 62 62 63 63 initialize(); -
trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp
r263410 r264176 49 49 // Node-specific default mixing rules. 50 50 m_channelCount = 2; 51 m_channelCountMode = Explicit;52 m_channelInterpretation = AudioBus::Speakers;51 m_channelCountMode = ChannelCountMode::Explicit; 52 m_channelInterpretation = ChannelInterpretation::Speakers; 53 53 } 54 54 -
trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp
r263985 r264176 33 33 #include "AudioNodeInput.h" 34 34 #include "AudioNodeOutput.h" 35 #include "ChannelCountMode.h" 35 36 #include "HRTFDatabaseLoader.h" 36 37 #include "HRTFPanner.h" … … 76 77 // Node-specific default mixing rules. 77 78 m_channelCount = 2; 78 m_channelCountMode = C lampedMax;79 m_channelInterpretation = AudioBus::Speakers;79 m_channelCountMode = ChannelCountMode::ClampedMax; 80 m_channelInterpretation = ChannelInterpretation::Speakers; 80 81 81 82 m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0); … … 114 115 return result.releaseException(); 115 116 116 result = panner->setChannelCountMode(options.channelCountMode. isNull() ? "clamped-max"_str : options.channelCountMode);117 if (result.hasException()) 118 return result.releaseException(); 119 120 result = panner->setChannelInterpretation(options.channelInterpretation. isNull() ? "speakers"_str : options.channelInterpretation);117 result = panner->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::ClampedMax)); 118 if (result.hasException()) 119 return result.releaseException(); 120 121 result = panner->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers)); 121 122 if (result.hasException()) 122 123 return result.releaseException(); … … 336 337 } 337 338 339 ExceptionOr<void> PannerNode::setChannelCount(unsigned channelCount) 340 { 341 if (channelCount > 2) 342 return Exception { NotSupportedError, "PannerNode's channelCount cannot be greater than 2"_s }; 343 344 return AudioNode::setChannelCount(channelCount); 345 } 346 347 ExceptionOr<void> PannerNode::setChannelCountMode(ChannelCountMode mode) 348 { 349 if (mode == ChannelCountMode::Max) 350 return Exception { NotSupportedError, "PannerNode's channelCountMode cannot be max"_s }; 351 352 return AudioNode::setChannelCountMode(mode); 353 } 354 338 355 void PannerNode::getAzimuthElevation(double* outAzimuth, double* outElevation) 339 356 { -
trunk/Source/WebCore/Modules/webaudio/PannerNode.h
r263985 r264176 128 128 double coneOuterGain() const { return m_coneEffect.outerGain(); } 129 129 ExceptionOr<void> setConeOuterGain(double); 130 131 ExceptionOr<void> setChannelCount(unsigned) final; 132 ExceptionOr<void> setChannelCountMode(ChannelCountMode) final; 130 133 131 134 void getAzimuthElevation(double* outAzimuth, double* outElevation); -
trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp
r263198 r264176 65 65 // Node-specific default mixing rules. 66 66 m_channelCount = 2; 67 m_channelCountMode = C lampedMax;68 m_channelInterpretation = AudioBus::Speakers;67 m_channelCountMode = ChannelCountMode::ClampedMax; 68 m_channelInterpretation = ChannelInterpretation::Speakers; 69 69 70 70 m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0); -
trunk/Source/WebCore/Sources.txt
r263985 r264176 2702 2702 JSCanvasTransform.cpp 2703 2703 JSCanvasUserInterface.cpp 2704 JSChannelCountMode.cpp 2705 JSChannelInterpretation.cpp 2704 2706 JSChannelMergerNode.cpp 2705 2707 JSChannelSplitterNode.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r264136 r264176 5046 5046 E71467B324ABAEF200FB2F50 /* AudioNodeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B124ABAEF100FB2F50 /* AudioNodeOptions.h */; }; 5047 5047 E71467B624ABAF1D00FB2F50 /* PannerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B524ABAF1D00FB2F50 /* PannerOptions.h */; }; 5048 E785D91524B4D1CA0014DB21 /* ChannelCountMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D91124B4D1B10014DB21 /* ChannelCountMode.h */; }; 5049 E785D93424B636FF0014DB21 /* ChannelInterpretation.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D93124B636FF0014DB21 /* ChannelInterpretation.h */; }; 5048 5050 EBE5B226245A26EF003A5A88 /* SQLiteStatementAutoResetScope.h in Headers */ = {isa = PBXBuildFile; fileRef = EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5049 5051 EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */; }; … … 15791 15793 E71467B524ABAF1D00FB2F50 /* PannerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PannerOptions.h; sourceTree = "<group>"; }; 15792 15794 E71467B724ABAF2C00FB2F50 /* PannerOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PannerOptions.idl; sourceTree = "<group>"; }; 15795 E785D91124B4D1B10014DB21 /* ChannelCountMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelCountMode.h; sourceTree = "<group>"; }; 15796 E785D91324B4D1B10014DB21 /* ChannelCountMode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelCountMode.idl; sourceTree = "<group>"; }; 15797 E785D93124B636FF0014DB21 /* ChannelInterpretation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelInterpretation.h; sourceTree = "<group>"; }; 15798 E785D93324B636FF0014DB21 /* ChannelInterpretation.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelInterpretation.idl; sourceTree = "<group>"; }; 15793 15799 EB081CD81696084400553730 /* TypeConversions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeConversions.h; sourceTree = "<group>"; }; 15794 15800 EB081CD91696084400553730 /* TypeConversions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypeConversions.idl; sourceTree = "<group>"; }; … … 29371 29377 FD315FDC12B0267600C1A359 /* BiquadProcessor.cpp */, 29372 29378 FD315FDD12B0267600C1A359 /* BiquadProcessor.h */, 29379 E785D91124B4D1B10014DB21 /* ChannelCountMode.h */, 29380 E785D91324B4D1B10014DB21 /* ChannelCountMode.idl */, 29381 E785D93124B636FF0014DB21 /* ChannelInterpretation.h */, 29382 E785D93324B636FF0014DB21 /* ChannelInterpretation.idl */, 29373 29383 FD315FB412B0267500C1A359 /* ChannelMergerNode.cpp */, 29374 29384 FD315FB512B0267500C1A359 /* ChannelMergerNode.h */, … … 30078 30088 FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */, 30079 30089 97BC69DD1505F076001B74AC /* ChangeVersionWrapper.h in Headers */, 30090 E785D91524B4D1CA0014DB21 /* ChannelCountMode.h in Headers */, 30091 E785D93424B636FF0014DB21 /* ChannelInterpretation.h in Headers */, 30080 30092 FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */, 30081 30093 FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */, -
trunk/Source/WebCore/platform/audio/AudioBus.cpp
r248846 r264176 254 254 } else { 255 255 switch (channelInterpretation) { 256 case Speakers:256 case ChannelInterpretation::Speakers: 257 257 speakersCopyFrom(sourceBus); 258 258 break; 259 case Discrete:259 case ChannelInterpretation::Discrete: 260 260 discreteCopyFrom(sourceBus); 261 261 break; … … 279 279 } else { 280 280 switch (channelInterpretation) { 281 case Speakers:281 case ChannelInterpretation::Speakers: 282 282 speakersSumFrom(sourceBus); 283 283 break; 284 case Discrete:284 case ChannelInterpretation::Discrete: 285 285 discreteSumFrom(sourceBus); 286 286 break; -
trunk/Source/WebCore/platform/audio/AudioBus.h
r260415 r264176 41 41 // The data layout is "planar" as opposed to "interleaved". 42 42 // An AudioBus with one channel is mono, an AudioBus with two channels is stereo, etc. 43 44 enum class ChannelInterpretation { 45 Speakers, 46 Discrete, 47 }; 48 43 49 class AudioBus final : public ThreadSafeRefCounted<AudioBus> { 44 50 WTF_MAKE_NONCOPYABLE(AudioBus); … … 57 63 LayoutCanonical = 0 58 64 // Can define non-standard layouts here 59 };60 61 enum ChannelInterpretation {62 Speakers,63 Discrete,64 65 }; 65 66 … … 127 128 // Copies the samples from the source bus to this one. 128 129 // This is just a simple per-channel copy if the number of channels match, otherwise an up-mix or down-mix is done. 129 WEBCORE_EXPORT void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);130 WEBCORE_EXPORT void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = ChannelInterpretation::Speakers); 130 131 131 132 // Sums the samples from the source bus to this one. 132 133 // This is just a simple per-channel summing if the number of channels match, otherwise an up-mix or down-mix is done. 133 void sumFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);134 void sumFrom(const AudioBus& sourceBus, ChannelInterpretation = ChannelInterpretation::Speakers); 134 135 135 136 // Copy each channel from sourceBus into our corresponding channel.
Note:
See TracChangeset
for help on using the changeset viewer.