Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265220 => 265221)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-03 21:49:41 UTC (rev 265221)
@@ -1,3 +1,15 @@
+2020-08-03 Chris Dumez <[email protected]>
+
+ Add constructor to DelayNode
+ https://bugs.webkit.org/show_bug.cgi?id=215083
+
+ Reviewed by Eric Carlson.
+
+ Rebaseline WPT tests now that more checks are passing.
+
+ * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/ctor-delay-expected.txt:
+
2020-08-03 Clark Wang <[email protected]>
Added AudioBuffer Constructor
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265220 => 265221)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-03 21:49:41 UTC (rev 265221)
@@ -646,38 +646,38 @@
FAIL AudioNode interface: new ConvolverNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
FAIL AudioNode interface: new ConvolverNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context)')"
PASS DelayNode interface: existence and properties of interface object
-FAIL DelayNode interface object length assert_equals: wrong value for DelayNode.length expected 1 but got 0
+PASS DelayNode interface object length
PASS DelayNode interface object name
PASS DelayNode interface: existence and properties of interface prototype object
PASS DelayNode interface: existence and properties of interface prototype object's "constructor" property
PASS DelayNode interface: existence and properties of interface prototype object's @@unscopables property
PASS DelayNode interface: attribute delayTime
-FAIL DelayNode must be primary interface of new DelayNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL Stringification of new DelayNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL DelayNode interface: new DelayNode(context) must inherit property "delayTime" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioParam)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "numberOfInputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "numberOfOutputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "channelCount" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
-FAIL AudioNode interface: new DelayNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new DelayNode(context)')"
+PASS DelayNode must be primary interface of new DelayNode(context)
+PASS Stringification of new DelayNode(context)
+PASS DelayNode interface: new DelayNode(context) must inherit property "delayTime" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect()" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioParam)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new DelayNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new DelayNode(context) must inherit property "context" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "numberOfInputs" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "numberOfOutputs" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "channelCount" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "channelCountMode" with the proper type
+PASS AudioNode interface: new DelayNode(context) must inherit property "channelInterpretation" with the proper type
PASS DynamicsCompressorNode interface: existence and properties of interface object
FAIL DynamicsCompressorNode interface object length assert_equals: wrong value for DynamicsCompressorNode.length expected 1 but got 0
PASS DynamicsCompressorNode interface object name
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/ctor-delay-expected.txt (265220 => 265221)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/ctor-delay-expected.txt 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/ctor-delay-expected.txt 2020-08-03 21:49:41 UTC (rev 265221)
@@ -2,24 +2,54 @@
PASS # AUDIT TASK RUNNER STARTED.
PASS Executing "initialize"
PASS Executing "invalid constructor"
-FAIL Executing "default constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.numberOfInputs')"
-FAIL Executing "test AudioNodeOptions" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.channelCount')"
-FAIL Executing "constructor options" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.delayTime')"
+PASS Executing "default constructor"
+PASS Executing "test AudioNodeOptions"
+PASS Executing "constructor options"
PASS Audit report
PASS > [initialize]
PASS context = new OfflineAudioContext(...) did not throw an exception.
PASS < [initialize] All assertions passed. (total 1 assertions)
PASS > [invalid constructor]
-PASS new DelayNode() threw TypeError: "function is not a constructor (evaluating 'new window[name]()')".
-PASS new DelayNode(1) threw TypeError: "function is not a constructor (evaluating 'new window[name](1)')".
-PASS new DelayNode(context, 42) threw TypeError: "function is not a constructor (evaluating 'new window[name](context, 42)')".
+PASS new DelayNode() threw TypeError: "Not enough arguments".
+PASS new DelayNode(1) threw TypeError: "Argument 1 ('context') to the DelayNode constructor must be an instance of BaseAudioContext".
+PASS new DelayNode(context, 42) threw TypeError: "Type error".
PASS < [invalid constructor] All assertions passed. (total 3 assertions)
PASS > [default constructor]
-FAIL X node0 = new DelayNode(context) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[name](context, options.constructorOptions)')". assert_true: expected true got false
-FAIL X node0 instanceof DelayNode is not equal to true. Got false. assert_true: expected true got false
+PASS node0 = new DelayNode(context) did not throw an exception.
+PASS node0 instanceof DelayNode is equal to true.
+PASS node0.numberOfInputs is equal to 1.
+PASS node0.numberOfOutputs is equal to 1.
+PASS node0.channelCount is equal to 2.
+PASS node0.channelCountMode is equal to max.
+PASS node0.channelInterpretation is equal to speakers.
+PASS node0.delayTime.value is equal to 0.
+PASS < [default constructor] All assertions passed. (total 8 assertions)
PASS > [test AudioNodeOptions]
-FAIL X new DelayNode(c, {channelCount: 17}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[nodeName]')". assert_true: expected true got false
+PASS new DelayNode(c, {channelCount: 17}) did not throw an exception.
+PASS node.channelCount is equal to 17.
+PASS new DelayNode(c, {channelCount: 0}) threw InvalidStateError: "The object is in an invalid state.".
+PASS new DelayNode(c, {channelCount: 99}) threw InvalidStateError: "The object is in an invalid state.".
+PASS new DelayNode(c, {channelCountMode: "max"} did not throw an exception.
+PASS node.channelCountMode is equal to max.
+PASS new DelayNode(c, {channelCountMode: "max"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to max.
+PASS new DelayNode(c, {channelCountMode: "clamped-max"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to clamped-max.
+PASS new DelayNode(c, {channelCountMode: "explicit"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to explicit.
+PASS new DelayNode(c, {channelCountMode: "foobar"} threw TypeError: "Type error".
+PASS node.channelCountMode after invalid setter is equal to explicit.
+PASS new DelayNode(c, {channelInterpretation: "speakers"}) did not throw an exception.
+PASS node.channelInterpretation is equal to speakers.
+PASS new DelayNode(c, {channelInterpretation: "discrete"}) did not throw an exception.
+PASS node.channelInterpretation is equal to discrete.
+PASS new DelayNode(c, {channelInterpretation: "foobar"}) threw TypeError: "Type error".
+PASS node.channelInterpretation after invalid setter is equal to discrete.
+PASS < [test AudioNodeOptions] All assertions passed. (total 20 assertions)
PASS > [constructor options]
-FAIL X node1 = new DelayNode(c, {"delayTime":0.5,"maxDelayTime":1.5}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new DelayNode(context, options)')". assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 3 out of 5 tasks were failed. assert_true: expected true got false
+PASS node1 = new DelayNode(c, {"delayTime":0.5,"maxDelayTime":1.5}) did not throw an exception.
+PASS node1.delayTime.value is equal to 0.5.
+PASS node1.delayTime.maxValue is equal to 1.5.
+PASS < [constructor options] All assertions passed. (total 3 assertions)
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully.
Modified: trunk/Source/WebCore/CMakeLists.txt (265220 => 265221)
--- trunk/Source/WebCore/CMakeLists.txt 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-08-03 21:49:41 UTC (rev 265221)
@@ -472,6 +472,7 @@
Modules/webaudio/ChannelSplitterOptions.idl
Modules/webaudio/ConvolverNode.idl
Modules/webaudio/DelayNode.idl
+ Modules/webaudio/DelayOptions.idl
Modules/webaudio/DistanceModelType.idl
Modules/webaudio/DynamicsCompressorNode.idl
Modules/webaudio/GainNode.idl
Modified: trunk/Source/WebCore/ChangeLog (265220 => 265221)
--- trunk/Source/WebCore/ChangeLog 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/ChangeLog 2020-08-03 21:49:41 UTC (rev 265221)
@@ -1,3 +1,37 @@
+2020-08-03 Chris Dumez <[email protected]>
+
+ Add constructor to DelayNode
+ https://bugs.webkit.org/show_bug.cgi?id=215083
+
+ Reviewed by Eric Carlson.
+
+ Add constructor to DelayNode:
+ - https://www.w3.org/TR/webaudio/#DelayNode
+
+ No new tests, rebaselined existing tests.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::createDelay):
+ * Modules/webaudio/DelayDSPKernel.cpp:
+ (WebCore::DelayDSPKernel::process):
+ * Modules/webaudio/DelayNode.cpp:
+ (WebCore::DelayNode::DelayNode):
+ (WebCore::DelayNode::create):
+ (WebCore::DelayNode::delayTime):
+ * Modules/webaudio/DelayNode.h:
+ * Modules/webaudio/DelayNode.idl:
+ * Modules/webaudio/DelayOptions.h: Copied from Source/WebCore/Modules/webaudio/DelayNode.idl.
+ * Modules/webaudio/DelayOptions.idl: Copied from Source/WebCore/Modules/webaudio/DelayNode.idl.
+ * Modules/webaudio/DelayProcessor.cpp:
+ (WebCore::DelayProcessor::DelayProcessor):
+ * Modules/webaudio/DelayProcessor.h:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2020-08-03 Myles C. Maxfield <[email protected]>
Make WidthIterator::advance() return void
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265220 => 265221)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-03 21:49:41 UTC (rev 265221)
@@ -321,6 +321,7 @@
$(PROJECT_DIR)/Modules/webaudio/ChannelSplitterOptions.idl
$(PROJECT_DIR)/Modules/webaudio/ConvolverNode.idl
$(PROJECT_DIR)/Modules/webaudio/DelayNode.idl
+$(PROJECT_DIR)/Modules/webaudio/DelayOptions.idl
$(PROJECT_DIR)/Modules/webaudio/DistanceModelType.idl
$(PROJECT_DIR)/Modules/webaudio/DynamicsCompressorNode.idl
$(PROJECT_DIR)/Modules/webaudio/GainNode.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265220 => 265221)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-03 21:49:41 UTC (rev 265221)
@@ -490,6 +490,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDedicatedWorkerGlobalScope.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDelayNode.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDelayNode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDelayOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDelayOptions.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDeprecatedCSSOMCounter.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDeprecatedCSSOMCounter.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDeprecatedCSSOMPrimitiveValue.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (265220 => 265221)
--- trunk/Source/WebCore/DerivedSources.make 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/DerivedSources.make 2020-08-03 21:49:41 UTC (rev 265221)
@@ -401,9 +401,10 @@
$(WebCore)/Modules/webaudio/ChannelMergerNode.idl \
$(WebCore)/Modules/webaudio/ChannelMergerOptions.idl \
$(WebCore)/Modules/webaudio/ChannelSplitterNode.idl \
- $(WebCore)/Modules/webaudio/ChannelSplitterOptions.idl \
+ $(WebCore)/Modules/webaudio/ChannelSplitterOptions.idl \
$(WebCore)/Modules/webaudio/ConvolverNode.idl \
$(WebCore)/Modules/webaudio/DelayNode.idl \
+ $(WebCore)/Modules/webaudio/DelayOptions.idl \
$(WebCore)/Modules/webaudio/DistanceModelType.idl \
$(WebCore)/Modules/webaudio/DynamicsCompressorNode.idl \
$(WebCore)/Modules/webaudio/GainNode.idl \
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-08-03 21:49:41 UTC (rev 265221)
@@ -47,6 +47,7 @@
#include "ConvolverNode.h"
#include "DefaultAudioDestinationNode.h"
#include "DelayNode.h"
+#include "DelayOptions.h"
#include "Document.h"
#include "DynamicsCompressorNode.h"
#include "EventNames.h"
@@ -567,11 +568,9 @@
ALWAYS_LOG(LOGIDENTIFIER);
ASSERT(isMainThread());
- if (m_isStopScheduled)
- return Exception { InvalidStateError };
-
- lazyInitialize();
- return DelayNode::create(*this, sampleRate(), maxDelayTime);
+ DelayOptions options;
+ options.maxDelayTime = maxDelayTime;
+ return DelayNode::create(*this, options);
}
ExceptionOr<Ref<ChannelSplitterNode>> BaseAudioContext::createChannelSplitter(size_t numberOfOutputs)
Modified: trunk/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp 2020-08-03 21:49:41 UTC (rev 265221)
@@ -102,12 +102,12 @@
float* delayTimes = m_delayTimes.data();
double maxTime = maxDelayTime();
- bool sampleAccurate = delayProcessor() && delayProcessor()->delayTime()->hasSampleAccurateValues();
+ bool sampleAccurate = delayProcessor() && delayProcessor()->delayTime().hasSampleAccurateValues();
if (sampleAccurate)
- delayProcessor()->delayTime()->calculateSampleAccurateValues(delayTimes, framesToProcess);
+ delayProcessor()->delayTime().calculateSampleAccurateValues(delayTimes, framesToProcess);
else {
- delayTime = delayProcessor() ? delayProcessor()->delayTime()->finalValue() : m_desiredDelayFrames / sampleRate;
+ delayTime = delayProcessor() ? delayProcessor()->delayTime().finalValue() : m_desiredDelayFrames / sampleRate;
// Make sure the delay time is in a valid range.
delayTime = std::min(maxTime, delayTime);
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-08-03 21:49:41 UTC (rev 265221)
@@ -28,6 +28,7 @@
#include "DelayNode.h"
+#include "DelayOptions.h"
#include "DelayProcessor.h"
#include <wtf/IsoMallocInlines.h>
@@ -37,21 +38,43 @@
const double maximumAllowedDelayTime = 180;
-inline DelayNode::DelayNode(BaseAudioContext& context, float sampleRate, double maxDelayTime)
- : AudioBasicProcessorNode(context, sampleRate)
+inline DelayNode::DelayNode(BaseAudioContext& context, double maxDelayTime)
+ : AudioBasicProcessorNode(context, context.sampleRate())
{
setNodeType(NodeTypeDelay);
- m_processor = makeUnique<DelayProcessor>(context, sampleRate, 1, maxDelayTime);
+ m_processor = makeUnique<DelayProcessor>(context, context.sampleRate(), 1, maxDelayTime);
}
-ExceptionOr<Ref<DelayNode>> DelayNode::create(BaseAudioContext& context, float sampleRate, double maxDelayTime)
+ExceptionOr<Ref<DelayNode>> DelayNode::create(BaseAudioContext& context, const DelayOptions& options)
{
- if (maxDelayTime <= 0 || maxDelayTime >= maximumAllowedDelayTime)
+ if (context.isStopped())
+ return Exception { InvalidStateError };
+
+ context.lazyInitialize();
+
+ if (options.maxDelayTime <= 0 || options.maxDelayTime >= maximumAllowedDelayTime)
return Exception { NotSupportedError };
- return adoptRef(*new DelayNode(context, sampleRate, maxDelayTime));
+
+ auto delayNode = adoptRef(*new DelayNode(context, options.maxDelayTime));
+
+ auto result = delayNode->setChannelCount(options.channelCount.valueOr(2));
+ if (result.hasException())
+ return result.releaseException();
+
+ result = delayNode->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::Max));
+ if (result.hasException())
+ return result.releaseException();
+
+ result = delayNode->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers));
+ if (result.hasException())
+ return result.releaseException();
+
+ delayNode->delayTime().setValue(options.delayTime);
+
+ return delayNode;
}
-AudioParam* DelayNode::delayTime()
+AudioParam& DelayNode::delayTime()
{
return static_cast<DelayProcessor&>(*m_processor).delayTime();
}
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.h (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.h 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.h 2020-08-03 21:49:41 UTC (rev 265221)
@@ -28,15 +28,17 @@
namespace WebCore {
+struct DelayOptions;
+
class DelayNode final : public AudioBasicProcessorNode {
WTF_MAKE_ISO_ALLOCATED(DelayNode);
public:
- static ExceptionOr<Ref<DelayNode>> create(BaseAudioContext&, float sampleRate, double maxDelayTime);
+ static ExceptionOr<Ref<DelayNode>> create(BaseAudioContext&, const DelayOptions&);
- AudioParam* delayTime();
+ AudioParam& delayTime();
private:
- DelayNode(BaseAudioContext&, float sampleRate, double maxDelayTime);
+ DelayNode(BaseAudioContext&, double maxDelayTime);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.idl (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.idl 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.idl 2020-08-03 21:49:41 UTC (rev 265221)
@@ -26,5 +26,7 @@
Conditional=WEB_AUDIO,
JSGenerateToJSObject
] interface DelayNode : AudioNode {
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional DelayOptions options);
+
readonly attribute AudioParam delayTime;
};
Copied: trunk/Source/WebCore/Modules/webaudio/DelayOptions.h (from rev 265220, trunk/Source/WebCore/Modules/webaudio/DelayNode.idl) (0 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayOptions.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/DelayOptions.h 2020-08-03 21:49:41 UTC (rev 265221)
@@ -0,0 +1,40 @@
+/*
+ * 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
+
+#if ENABLE(WEB_AUDIO)
+
+#include "AudioNodeOptions.h"
+
+namespace WebCore {
+
+struct DelayOptions : AudioNodeOptions {
+ double maxDelayTime { 1 };
+ double delayTime { 0 };
+};
+
+}
+
+#endif // ENABLE(WEB_AUDIO)
Copied: trunk/Source/WebCore/Modules/webaudio/DelayOptions.idl (from rev 265220, trunk/Source/WebCore/Modules/webaudio/DelayNode.idl) (0 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayOptions.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/DelayOptions.idl 2020-08-03 21:49:41 UTC (rev 265221)
@@ -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
+] dictionary DelayOptions : AudioNodeOptions {
+ double maxDelayTime = 1;
+ double delayTime = 0;
+};
Modified: trunk/Source/WebCore/Modules/webaudio/DelayProcessor.cpp (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayProcessor.cpp 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayProcessor.cpp 2020-08-03 21:49:41 UTC (rev 265221)
@@ -34,9 +34,9 @@
DelayProcessor::DelayProcessor(BaseAudioContext& context, float sampleRate, unsigned numberOfChannels, double maxDelayTime)
: AudioDSPKernelProcessor(sampleRate, numberOfChannels)
- , m_maxDelayTime(maxDelayTime)
+ , m_delayTime(AudioParam::create(context, "delayTime", 0.0, 0.0, maxDelayTime))
{
- m_delayTime = AudioParam::create(context, "delayTime", 0.0, 0.0, maxDelayTime);
+
}
DelayProcessor::~DelayProcessor()
Modified: trunk/Source/WebCore/Modules/webaudio/DelayProcessor.h (265220 => 265221)
--- trunk/Source/WebCore/Modules/webaudio/DelayProcessor.h 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Modules/webaudio/DelayProcessor.h 2020-08-03 21:49:41 UTC (rev 265221)
@@ -41,13 +41,11 @@
std::unique_ptr<AudioDSPKernel> createKernel() override;
- AudioParam* delayTime() const { return m_delayTime.get(); }
+ AudioParam& delayTime() const { return m_delayTime.get(); }
+ double maxDelayTime() { return delayTime().maxValue(); }
- double maxDelayTime() { return m_maxDelayTime; }
private:
-
- RefPtr<AudioParam> m_delayTime;
- double m_maxDelayTime;
+ Ref<AudioParam> m_delayTime;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Sources.txt (265220 => 265221)
--- trunk/Source/WebCore/Sources.txt 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/Sources.txt 2020-08-03 21:49:41 UTC (rev 265221)
@@ -2798,6 +2798,7 @@
JSDatabaseCallback.cpp
JSDedicatedWorkerGlobalScope.cpp
JSDelayNode.cpp
+JSDelayOptions.cpp
JSDeprecatedCSSOMCounter.cpp
JSDeprecatedCSSOMPrimitiveValue.cpp
JSDeprecatedCSSOMRGBColor.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265220 => 265221)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-03 21:35:53 UTC (rev 265220)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-03 21:49:41 UTC (rev 265221)
@@ -1405,8 +1405,8 @@
510A91F624D32DDC00BFD89C /* Dualshock3HIDGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A91F424D324FF00BFD89C /* Dualshock3HIDGamepad.h */; };
510A91FD24D3C16200BFD89C /* GamepadConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 51715FE924CD05DD002C97E6 /* GamepadConstants.h */; };
510A91FE24D3C16700BFD89C /* GamepadConstantsMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A91FB24D3C0FD00BFD89C /* GamepadConstantsMac.h */; };
+ 510A920824D4F49900BFD89C /* LogitechGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A920524D4F07A00BFD89C /* LogitechGamepad.h */; };
510A921224D5E60E00BFD89C /* StadiaHIDGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A921124D5E21700BFD89C /* StadiaHIDGamepad.h */; };
- 510A920824D4F49900BFD89C /* LogitechGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A920524D4F07A00BFD89C /* LogitechGamepad.h */; };
510D4A34103165EE0049EA54 /* SocketStreamError.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A2E103165EE0049EA54 /* SocketStreamError.h */; settings = {ATTRIBUTES = (Private, ); }; };
510D4A37103165EE0049EA54 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A31103165EE0049EA54 /* SocketStreamHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2494,6 +2494,7 @@
839947101F50B6FA00E9D86B /* JSDOMFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8399470E1F50B6F300E9D86B /* JSDOMFileSystem.h */; };
839A2F2E1E204A710039057E /* WebGLStateTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
+ 83A2ABDB24D86DE000E2D73D /* DelayOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A2ABD824D86DC600E2D73D /* DelayOptions.h */; };
83A8AC401FABBFE5002064AC /* ServiceWorkerIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A8AC3E1FABBFD1002064AC /* ServiceWorkerIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B1A702249985F000FE5961 /* WebKitAudioContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B1A6FF249985D000FE5961 /* WebKitAudioContext.h */; };
83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8239,10 +8240,10 @@
510A91F424D324FF00BFD89C /* Dualshock3HIDGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Dualshock3HIDGamepad.h; sourceTree = "<group>"; };
510A91F524D3250000BFD89C /* Dualshock3HIDGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Dualshock3HIDGamepad.cpp; sourceTree = "<group>"; };
510A91FB24D3C0FD00BFD89C /* GamepadConstantsMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadConstantsMac.h; sourceTree = "<group>"; };
+ 510A920524D4F07A00BFD89C /* LogitechGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogitechGamepad.h; sourceTree = "<group>"; };
+ 510A920724D4F07A00BFD89C /* LogitechGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LogitechGamepad.cpp; sourceTree = "<group>"; };
510A920F24D5E21700BFD89C /* StadiaHIDGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StadiaHIDGamepad.cpp; sourceTree = "<group>"; };
510A921124D5E21700BFD89C /* StadiaHIDGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StadiaHIDGamepad.h; sourceTree = "<group>"; };
- 510A920524D4F07A00BFD89C /* LogitechGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogitechGamepad.h; sourceTree = "<group>"; };
- 510A920724D4F07A00BFD89C /* LogitechGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LogitechGamepad.cpp; sourceTree = "<group>"; };
510D4A2E103165EE0049EA54 /* SocketStreamError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamError.h; sourceTree = "<group>"; };
510D4A30103165EE0049EA54 /* SocketStreamHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandle.cpp; sourceTree = "<group>"; };
510D4A31103165EE0049EA54 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandle.h; sourceTree = "<group>"; };
@@ -10560,6 +10561,8 @@
839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLStateTracker.h; sourceTree = "<group>"; };
839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
+ 83A2ABD824D86DC600E2D73D /* DelayOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DelayOptions.h; sourceTree = "<group>"; };
+ 83A2ABDA24D86DC700E2D73D /* DelayOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DelayOptions.idl; sourceTree = "<group>"; };
83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; };
83A8AC3E1FABBFD1002064AC /* ServiceWorkerIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerIdentifier.h; sourceTree = "<group>"; };
83B1A6FF249985D000FE5961 /* WebKitAudioContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAudioContext.h; sourceTree = "<group>"; };
@@ -29566,6 +29569,8 @@
FD315FE312B0267600C1A359 /* DelayNode.cpp */,
FD315FE412B0267600C1A359 /* DelayNode.h */,
FD315FE512B0267600C1A359 /* DelayNode.idl */,
+ 83A2ABD824D86DC600E2D73D /* DelayOptions.h */,
+ 83A2ABDA24D86DC700E2D73D /* DelayOptions.idl */,
FD315FE612B0267600C1A359 /* DelayProcessor.cpp */,
FD315FE712B0267600C1A359 /* DelayProcessor.h */,
8304027D249A7A5B00A90D8D /* DistanceModelType.h */,
@@ -30639,6 +30644,7 @@
CD83D36221122A210076E11C /* DeferrableTask.h in Headers */,
FD31602C12B0267600C1A359 /* DelayDSPKernel.h in Headers */,
FD31602E12B0267600C1A359 /* DelayNode.h in Headers */,
+ 83A2ABDB24D86DE000E2D73D /* DelayOptions.h in Headers */,
FD31603112B0267600C1A359 /* DelayProcessor.h in Headers */,
93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
93309DE1099E64920056E581 /* DeleteSelectionCommand.h in Headers */,