Title: [265290] trunk
Revision
265290
Author
cdu...@apple.com
Date
2020-08-05 09:52:17 -0700 (Wed, 05 Aug 2020)

Log Message

Add constructor to BiquadFilterNode
https://bugs.webkit.org/show_bug.cgi?id=215144

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

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-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter-expected.txt:

Source/WebCore:

Add constructor to BiquadFilterNode:
- https://webaudio.github.io/web-audio-api/#biquadfilternode

No new tests, rebaselined existing tests..

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::createBiquadFilter):
* Modules/webaudio/BiquadDSPKernel.cpp:
(WebCore::BiquadDSPKernel::updateCoefficientsIfNecessary):
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::create):
(WebCore::BiquadFilterNode::BiquadFilterNode):
* Modules/webaudio/BiquadFilterNode.h:
* Modules/webaudio/BiquadFilterNode.idl:
* Modules/webaudio/BiquadFilterOptions.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
* Modules/webaudio/BiquadFilterOptions.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
* Modules/webaudio/BiquadFilterType.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
* Modules/webaudio/BiquadFilterType.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
* Modules/webaudio/BiquadProcessor.cpp:
(WebCore::BiquadProcessor::BiquadProcessor):
* Modules/webaudio/BiquadProcessor.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/TestExpectations (265289 => 265290)


--- trunk/LayoutTests/TestExpectations	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/LayoutTests/TestExpectations	2020-08-05 16:52:17 UTC (rev 265290)
@@ -313,6 +313,7 @@
 # Test prints out sample rate, which appears to be hardware-specific.
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html [ Pass Failure ]
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html [ Pass Failure ]
+imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse.html [ Pass Failure ]
 
 # Some of the subchecks are failing and print out a different value every time.
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html [ Pass Failure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265289 => 265290)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-05 16:52:17 UTC (rev 265290)
@@ -1,3 +1,16 @@
+2020-08-05  Chris Dumez  <cdu...@apple.com>
+
+        Add constructor to BiquadFilterNode
+        https://bugs.webkit.org/show_bug.cgi?id=215144
+
+        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-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter-expected.txt:
+
 2020-08-05  Rob Buis  <rb...@igalia.com>
 
         Allow multiple calls to PerformanceObserver.observe with different types

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265289 => 265290)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-05 16:52:17 UTC (rev 265290)
@@ -467,7 +467,7 @@
         playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
       })')"
 PASS BiquadFilterNode interface: existence and properties of interface object 
-FAIL BiquadFilterNode interface object length assert_equals: wrong value for BiquadFilterNode.length expected 1 but got 0
+PASS BiquadFilterNode interface object length 
 PASS BiquadFilterNode interface object name 
 PASS BiquadFilterNode interface: existence and properties of interface prototype object 
 PASS BiquadFilterNode interface: existence and properties of interface prototype object's "constructor" property 
@@ -478,38 +478,38 @@
 PASS BiquadFilterNode interface: attribute Q 
 PASS BiquadFilterNode interface: attribute gain 
 PASS BiquadFilterNode interface: operation getFrequencyResponse(Float32Array, Float32Array, Float32Array) 
-FAIL BiquadFilterNode must be primary interface of new BiquadFilterNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL Stringification of new BiquadFilterNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "frequency" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "detune" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "Q" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "gain" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "getFrequencyResponse(Float32Array, Float32Array, Float32Array)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode(context)')"
-FAIL BiquadFilterNode interface: calling getFrequencyResponse(Float32Array, Float32Array, Float32Array) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
-FAIL AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context)')"
+PASS BiquadFilterNode must be primary interface of new BiquadFilterNode(context) 
+PASS Stringification of new BiquadFilterNode(context) 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "type" with the proper type 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "frequency" with the proper type 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "detune" with the proper type 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "Q" with the proper type 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "gain" with the proper type 
+PASS BiquadFilterNode interface: new BiquadFilterNode(context) must inherit property "getFrequencyResponse(Float32Array, Float32Array, Float32Array)" with the proper type 
+PASS BiquadFilterNode interface: calling getFrequencyResponse(Float32Array, Float32Array, Float32Array) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type 
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect()" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect(unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(unsigned long) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect(AudioNode)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(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 BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect(AudioParam)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new BiquadFilterNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "context" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "numberOfInputs" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "numberOfOutputs" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "channelCount" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "channelCountMode" with the proper type 
+PASS AudioNode interface: new BiquadFilterNode(context) must inherit property "channelInterpretation" with the proper type 
 PASS ChannelMergerNode interface: existence and properties of interface object 
 PASS ChannelMergerNode interface object length 
 PASS ChannelMergerNode interface object name 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt (265289 => 265290)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt	2020-08-05 16:52:17 UTC (rev 265290)
@@ -1,23 +1,87 @@
 
 PASS # AUDIT TASK RUNNER STARTED. 
-FAIL Executing "lowpass" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "highpass" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "bandpass" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "lowshelf" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "highshelf" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "peaking" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "notch" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
-FAIL Executing "allpass" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new BiquadFilterNode')"
+PASS Executing "lowpass" 
+PASS Executing "highpass" 
+PASS Executing "bandpass" 
+PASS Executing "lowshelf" 
+PASS Executing "highshelf" 
+PASS Executing "peaking" 
+PASS Executing "notch" 
+PASS Executing "allpass" 
 FAIL Executing "getFrequencyResponse" promise_test: Unhandled rejection with value: object "SyntaxError: The string did not match the expected pattern."
 PASS Audit report 
 PASS > [lowpass] Frequency response 
+PASS   lowpass: Number of non-finite values in magnitude response is equal to 0. 
+PASS   lowpass: Number of non-finte values in phase response is equal to 0. 
+PASS   lowpass: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   lowpass: Number of non-finite values in expected phase response is equal to 0. 
+PASS   lowpass: Actual and expected results contained only finite values is true. 
+FAIL X lowpass: Max error (2.8336142432639253 dB) of magnitude response at frequency 1008 Hz is not less than or equal to -73.01779999999998. Got 2.8336142432639253. assert_true: expected true got false
+FAIL X lowpass: Max error (4.566711633161105 deg) in phase response at frequency 1584 Hz is not less than or equal to 0.000460864332091429. Got 4.566711633161105. assert_true: expected true got false
+FAIL < [lowpass] 2 out of 7 assertions were failed. assert_true: expected true got false
 PASS > [highpass] Frequency response 
+PASS   highpass: Number of non-finite values in magnitude response is equal to 0. 
+PASS   highpass: Number of non-finte values in phase response is equal to 0. 
+PASS   highpass: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   highpass: Number of non-finite values in expected phase response is equal to 0. 
+PASS   highpass: Actual and expected results contained only finite values is true. 
+FAIL X highpass: Max error (2.8336167311899474 dB) of magnitude response at frequency 1008 Hz is not less than or equal to -117.5461. Got 2.8336167311899474. assert_true: expected true got false
+FAIL X highpass: Max error (4.5667166421174645 deg) in phase response at frequency 1584 Hz is not less than or equal to 0.00039930001700462205. Got 4.5667166421174645. assert_true: expected true got false
+FAIL < [highpass] 2 out of 7 assertions were failed. assert_true: expected true got false
 PASS > [bandpass] Frequency response 
+PASS   bandpass: Number of non-finite values in magnitude response is equal to 0. 
+PASS   bandpass: Number of non-finte values in phase response is equal to 0. 
+PASS   bandpass: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   bandpass: Number of non-finite values in expected phase response is equal to 0. 
+PASS   bandpass: Actual and expected results contained only finite values is true. 
+PASS   bandpass: Max error (-79.01394922508145 dB) of magnitude response at frequency 23952 Hz is less than or equal to -79.01389999999999. 
+PASS   bandpass: Max error (0.000004937042988127661 deg) in phase response at frequency 816 Hz is less than or equal to 0.0002828749930340387. 
+PASS < [bandpass] All assertions passed. (total 7 assertions) 
 PASS > [lowshelf] Frequency response 
+PASS   lowshelf: Number of non-finite values in magnitude response is equal to 0. 
+PASS   lowshelf: Number of non-finte values in phase response is equal to 0. 
+PASS   lowshelf: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   lowshelf: Number of non-finite values in expected phase response is equal to 0. 
+PASS   lowshelf: Actual and expected results contained only finite values is true. 
+PASS   lowshelf: Max error (-125.72006443816068 dB) of magnitude response at frequency 9048 Hz is less than or equal to -120.4038. 
+PASS   lowshelf: Max error (0.0000010998019550260546 deg) in phase response at frequency 1176 Hz is less than or equal to 0.00023333133248907645. 
+PASS < [lowshelf] All assertions passed. (total 7 assertions) 
 PASS > [highshelf] Frequency response 
+PASS   highshelf: Number of non-finite values in magnitude response is equal to 0. 
+PASS   highshelf: Number of non-finte values in phase response is equal to 0. 
+PASS   highshelf: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   highshelf: Number of non-finite values in expected phase response is equal to 0. 
+PASS   highshelf: Actual and expected results contained only finite values is true. 
+PASS   highshelf: Max error (-125.38513197921183 dB) of magnitude response at frequency 864 Hz is less than or equal to -119.99999999999999. 
+PASS   highshelf: Max error (0.000001099801293470681 deg) in phase response at frequency 1176 Hz is less than or equal to 0.00023333133248907645. 
+PASS < [highshelf] All assertions passed. (total 7 assertions) 
 PASS > [peaking] Frequency response 
+PASS   peaking: Number of non-finite values in magnitude response is equal to 0. 
+PASS   peaking: Number of non-finte values in phase response is equal to 0. 
+PASS   peaking: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   peaking: Number of non-finite values in expected phase response is equal to 0. 
+PASS   peaking: Actual and expected results contained only finite values is true. 
+PASS   peaking: Max error (-124.9664097542858 dB) of magnitude response at frequency 1992 Hz is less than or equal to -119.11759999999998. 
+PASS   peaking: Max error (0.0000022600132665057376 deg) in phase response at frequency 1080 Hz is less than or equal to 0.0000037084120332047404. 
+PASS < [peaking] All assertions passed. (total 7 assertions) 
 PASS > [notch] Frequency response 
+PASS   notch: Number of non-finite values in magnitude response is equal to 0. 
+PASS   notch: Number of non-finte values in phase response is equal to 0. 
+PASS   notch: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   notch: Number of non-finite values in expected phase response is equal to 0. 
+PASS   notch: Actual and expected results contained only finite values is true. 
+PASS   notch: Max error (-96.65213672776751 dB) of magnitude response at frequency 1008 Hz is less than or equal to -87.08079999999998. 
+PASS   notch: Max error (0.0000066299355314361 deg) in phase response at frequency 1080 Hz is less than or equal to 0.0003798710181717358. 
+PASS < [notch] All assertions passed. (total 7 assertions) 
 PASS > [allpass] Frequency response 
+PASS   allpass: Number of non-finite values in magnitude response is equal to 0. 
+PASS   allpass: Number of non-finte values in phase response is equal to 0. 
+PASS   allpass: Number of non-finite values in the expected magnitude response is equal to 0. 
+PASS   allpass: Number of non-finite values in expected phase response is equal to 0. 
+PASS   allpass: Actual and expected results contained only finite values is true. 
+PASS   allpass: Max error (-266.8735521058153 dB) of magnitude response at frequency 1056 Hz is less than or equal to -265.35169999999994. 
+PASS   allpass: Max error (0.000013259871597205388 deg) in phase response at frequency 1080 Hz is less than or equal to 0.0007597420363434716. 
+PASS < [allpass] All assertions passed. (total 7 assertions) 
 PASS > [getFrequencyResponse] Test out-of-bounds frequency values 
-PASS # AUDIT TASK RUNNER FINISHED: 9 tasks ran successfully. 
+FAIL # AUDIT TASK RUNNER FINISHED: 2 out of 9 tasks were failed. assert_true: expected true got false
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter-expected.txt (265289 => 265290)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter-expected.txt	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter-expected.txt	2020-08-05 16:52:17 UTC (rev 265290)
@@ -2,24 +2,61 @@
 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 "construct with options" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.type')"
+PASS Executing "default constructor" 
+PASS Executing "test AudioNodeOptions" 
+PASS Executing "construct with 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 BiquadFilterNode() threw TypeError: "function is not a constructor (evaluating 'new window[name]()')". 
-PASS   new BiquadFilterNode(1) threw TypeError: "function is not a constructor (evaluating 'new window[name](1)')". 
-PASS   new BiquadFilterNode(context, 42) threw TypeError: "function is not a constructor (evaluating 'new window[name](context, 42)')". 
+PASS   new BiquadFilterNode() threw TypeError: "Not enough arguments". 
+PASS   new BiquadFilterNode(1) threw TypeError: "Argument 1 ('context') to the BiquadFilterNode constructor must be an instance of BaseAudioContext". 
+PASS   new BiquadFilterNode(context, 42) threw TypeError: "Type error". 
 PASS < [invalid constructor] All assertions passed. (total 3 assertions) 
 PASS > [default constructor]  
-FAIL X node0 = new BiquadFilterNode(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 BiquadFilterNode is not equal to true. Got false. assert_true: expected true got false
+PASS   node0 = new BiquadFilterNode(context) did not throw an exception. 
+PASS   node0 instanceof BiquadFilterNode 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.type is equal to lowpass. 
+PASS   node0.Q.value is equal to 1. 
+PASS   node0.detune.value is equal to 0. 
+PASS   node0.frequency.value is equal to 350. 
+PASS   node0.gain.value is equal to 0. 
+PASS < [default constructor] All assertions passed. (total 12 assertions) 
 PASS > [test AudioNodeOptions]  
-FAIL X new BiquadFilterNode(c, {channelCount: 17}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[nodeName]')". assert_true: expected true got false
+PASS   new BiquadFilterNode(c, {channelCount: 17}) did not throw an exception. 
+PASS   node.channelCount is equal to 17. 
+PASS   new BiquadFilterNode(c, {channelCount: 0}) threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new BiquadFilterNode(c, {channelCount: 99}) threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new BiquadFilterNode(c, {channelCountMode: "max"} did not throw an exception. 
+PASS   node.channelCountMode is equal to max. 
+PASS   new BiquadFilterNode(c, {channelCountMode: "max"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to max. 
+PASS   new BiquadFilterNode(c, {channelCountMode: "clamped-max"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to clamped-max. 
+PASS   new BiquadFilterNode(c, {channelCountMode: "explicit"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to explicit. 
+PASS   new BiquadFilterNode(c, {channelCountMode: "foobar"} threw TypeError: "Type error". 
+PASS   node.channelCountMode after invalid setter is equal to explicit. 
+PASS   new BiquadFilterNode(c, {channelInterpretation: "speakers"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to speakers. 
+PASS   new BiquadFilterNode(c, {channelInterpretation: "discrete"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to discrete. 
+PASS   new BiquadFilterNode(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 > [construct with options]  
-FAIL X node = new BiquadFilterNode(..., {"type":"highpass","frequency":512,"detune":1,"Q":5,"gain":3}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new BiquadFilterNode(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   node = new BiquadFilterNode(..., {"type":"highpass","frequency":512,"detune":1,"Q":5,"gain":3}) did not throw an exception. 
+PASS   node.type is equal to highpass. 
+PASS   node.frequency.value is equal to 512. 
+PASS   node.detuen.value is equal to 1. 
+PASS   node.Q.value is equal to 5. 
+PASS   node.gain.value is equal to 3. 
+PASS < [construct with options] All assertions passed. (total 6 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/CMakeLists.txt (265289 => 265290)


--- trunk/Source/WebCore/CMakeLists.txt	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-08-05 16:52:17 UTC (rev 265290)
@@ -465,6 +465,8 @@
     Modules/webaudio/AudioScheduledSourceNode.idl
     Modules/webaudio/BaseAudioContext.idl
     Modules/webaudio/BiquadFilterNode.idl
+    Modules/webaudio/BiquadFilterOptions.idl
+    Modules/webaudio/BiquadFilterType.idl
     Modules/webaudio/ChannelCountMode.idl
     Modules/webaudio/ChannelInterpretation.idl
     Modules/webaudio/ChannelMergerNode.idl

Modified: trunk/Source/WebCore/ChangeLog (265289 => 265290)


--- trunk/Source/WebCore/ChangeLog	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/ChangeLog	2020-08-05 16:52:17 UTC (rev 265290)
@@ -1,3 +1,38 @@
+2020-08-05  Chris Dumez  <cdu...@apple.com>
+
+        Add constructor to BiquadFilterNode
+        https://bugs.webkit.org/show_bug.cgi?id=215144
+
+        Reviewed by Eric Carlson.
+
+        Add constructor to BiquadFilterNode:
+        - https://webaudio.github.io/web-audio-api/#biquadfilternode
+
+        No new tests, rebaselined existing tests..
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webaudio/BaseAudioContext.cpp:
+        (WebCore::BaseAudioContext::createBiquadFilter):
+        * Modules/webaudio/BiquadDSPKernel.cpp:
+        (WebCore::BiquadDSPKernel::updateCoefficientsIfNecessary):
+        * Modules/webaudio/BiquadFilterNode.cpp:
+        (WebCore::BiquadFilterNode::create):
+        (WebCore::BiquadFilterNode::BiquadFilterNode):
+        * Modules/webaudio/BiquadFilterNode.h:
+        * Modules/webaudio/BiquadFilterNode.idl:
+        * Modules/webaudio/BiquadFilterOptions.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
+        * Modules/webaudio/BiquadFilterOptions.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
+        * Modules/webaudio/BiquadFilterType.h: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
+        * Modules/webaudio/BiquadFilterType.idl: Copied from Source/WebCore/Modules/webaudio/BiquadFilterNode.idl.
+        * Modules/webaudio/BiquadProcessor.cpp:
+        (WebCore::BiquadProcessor::BiquadProcessor):
+        * Modules/webaudio/BiquadProcessor.h:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2020-08-04  Simon Fraser  <simon.fra...@apple.com>
 
         Update event regions only once per frame

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265289 => 265290)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-05 16:52:17 UTC (rev 265290)
@@ -314,6 +314,8 @@
 $(PROJECT_DIR)/Modules/webaudio/AudioScheduledSourceNode.idl
 $(PROJECT_DIR)/Modules/webaudio/BaseAudioContext.idl
 $(PROJECT_DIR)/Modules/webaudio/BiquadFilterNode.idl
+$(PROJECT_DIR)/Modules/webaudio/BiquadFilterOptions.idl
+$(PROJECT_DIR)/Modules/webaudio/BiquadFilterType.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelCountMode.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelInterpretation.idl
 $(PROJECT_DIR)/Modules/webaudio/ChannelMergerNode.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265289 => 265290)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-05 16:52:17 UTC (rev 265290)
@@ -211,6 +211,10 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBeforeUnloadEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterNode.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterNode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterOptions.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterType.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterType.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBlob.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBlob.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBlobCallback.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (265289 => 265290)


--- trunk/Source/WebCore/DerivedSources.make	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/DerivedSources.make	2020-08-05 16:52:17 UTC (rev 265290)
@@ -397,6 +397,8 @@
     $(WebCore)/Modules/webaudio/AudioScheduledSourceNode.idl \
     $(WebCore)/Modules/webaudio/BaseAudioContext.idl \
     $(WebCore)/Modules/webaudio/BiquadFilterNode.idl \
+    $(WebCore)/Modules/webaudio/BiquadFilterOptions.idl \
+    $(WebCore)/Modules/webaudio/BiquadFilterType.idl \
     $(WebCore)/Modules/webaudio/ChannelCountMode.idl \
     $(WebCore)/Modules/webaudio/ChannelInterpretation.idl \
     $(WebCore)/Modules/webaudio/ChannelMergerNode.idl \

Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp	2020-08-05 16:52:17 UTC (rev 265290)
@@ -488,12 +488,7 @@
     ALWAYS_LOG(LOGIDENTIFIER);
     
     ASSERT(isMainThread());
-    if (m_isStopScheduled)
-        return Exception { InvalidStateError };
-
-    lazyInitialize();
-
-    return BiquadFilterNode::create(*this, sampleRate());
+    return BiquadFilterNode::create(*this);
 }
 
 ExceptionOr<Ref<WaveShaperNode>> BaseAudioContext::createWaveShaper()

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp	2020-08-05 16:52:17 UTC (rev 265290)
@@ -50,20 +50,20 @@
         double detune; // in Cents
 
         if (biquadProcessor()->hasSampleAccurateValues()) {
-            value1 = biquadProcessor()->parameter1()->finalValue();
-            value2 = biquadProcessor()->parameter2()->finalValue();
-            gain = biquadProcessor()->parameter3()->finalValue();
-            detune = biquadProcessor()->parameter4()->finalValue();
+            value1 = biquadProcessor()->parameter1().finalValue();
+            value2 = biquadProcessor()->parameter2().finalValue();
+            gain = biquadProcessor()->parameter3().finalValue();
+            detune = biquadProcessor()->parameter4().finalValue();
         } else if (useSmoothing) {
-            value1 = biquadProcessor()->parameter1()->smoothedValue();
-            value2 = biquadProcessor()->parameter2()->smoothedValue();
-            gain = biquadProcessor()->parameter3()->smoothedValue();
-            detune = biquadProcessor()->parameter4()->smoothedValue();
+            value1 = biquadProcessor()->parameter1().smoothedValue();
+            value2 = biquadProcessor()->parameter2().smoothedValue();
+            gain = biquadProcessor()->parameter3().smoothedValue();
+            detune = biquadProcessor()->parameter4().smoothedValue();
         } else {
-            value1 = biquadProcessor()->parameter1()->value();
-            value2 = biquadProcessor()->parameter2()->value();
-            gain = biquadProcessor()->parameter3()->value();
-            detune = biquadProcessor()->parameter4()->value();
+            value1 = biquadProcessor()->parameter1().value();
+            value2 = biquadProcessor()->parameter2().value();
+            gain = biquadProcessor()->parameter3().value();
+            detune = biquadProcessor()->parameter4().value();
         }
 
         // Convert from Hertz to normalized frequency 0 -> 1.

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp	2020-08-05 16:52:17 UTC (rev 265290)
@@ -33,13 +33,43 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(BiquadFilterNode);
 
-BiquadFilterNode::BiquadFilterNode(BaseAudioContext& context, float sampleRate)
-    : AudioBasicProcessorNode(context, sampleRate)
+ExceptionOr<Ref<BiquadFilterNode>> BiquadFilterNode::create(BaseAudioContext& context, const BiquadFilterOptions& options)
 {
+    if (context.isStopped())
+        return Exception { InvalidStateError };
+
+    context.lazyInitialize();
+
+    auto node = adoptRef(*new BiquadFilterNode(context));
+
+    auto result = node->setChannelCount(options.channelCount.valueOr(2));
+    if (result.hasException())
+        return result.releaseException();
+
+    result = node->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::Max));
+    if (result.hasException())
+        return result.releaseException();
+
+    result = node->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers));
+    if (result.hasException())
+        return result.releaseException();
+
+    node->setType(options.type);
+    node->q().setValue(options.Q);
+    node->detune().setValue(options.detune);
+    node->frequency().setValue(options.frequency);
+    node->gain().setValue(options.gain);
+
+    return node;
+}
+
+BiquadFilterNode::BiquadFilterNode(BaseAudioContext& context)
+    : AudioBasicProcessorNode(context, context.sampleRate())
+{
     setNodeType(NodeTypeBiquadFilter);
 
     // Initially setup as lowpass filter.
-    m_processor = makeUnique<BiquadProcessor>(context, sampleRate, 1, false);
+    m_processor = makeUnique<BiquadProcessor>(context, context.sampleRate(), 1, false);
 }
 
 BiquadFilterType BiquadFilterNode::type() const

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h	2020-08-05 16:52:17 UTC (rev 265290)
@@ -25,6 +25,7 @@
 #pragma once
 
 #include "AudioBasicProcessorNode.h"
+#include "BiquadFilterOptions.h"
 #include "BiquadProcessor.h"
 
 namespace WebCore {
@@ -34,18 +35,15 @@
 class BiquadFilterNode final : public AudioBasicProcessorNode {
     WTF_MAKE_ISO_ALLOCATED(BiquadFilterNode);
 public:
-    static Ref<BiquadFilterNode> create(BaseAudioContext& context, float sampleRate)
-    {
-        return adoptRef(*new BiquadFilterNode(context, sampleRate));
-    }
+    static ExceptionOr<Ref<BiquadFilterNode>> create(BaseAudioContext& context, const BiquadFilterOptions& = { });
 
     BiquadFilterType type() const;
     void setType(BiquadFilterType);
 
-    AudioParam* frequency() { return biquadProcessor()->parameter1(); }
-    AudioParam* q() { return biquadProcessor()->parameter2(); }
-    AudioParam* gain() { return biquadProcessor()->parameter3(); }
-    AudioParam* detune() { return biquadProcessor()->parameter4(); }
+    AudioParam& frequency() { return biquadProcessor()->parameter1(); }
+    AudioParam& q() { return biquadProcessor()->parameter2(); }
+    AudioParam& gain() { return biquadProcessor()->parameter3(); }
+    AudioParam& detune() { return biquadProcessor()->parameter4(); }
 
     // Get the magnitude and phase response of the filter at the given
     // set of frequencies (in Hz). The phase response is in radians.
@@ -52,7 +50,7 @@
     void getFrequencyResponse(const RefPtr<Float32Array>& frequencyHz, const RefPtr<Float32Array>& magResponse, const RefPtr<Float32Array>& phaseResponse);
 
 private:
-    BiquadFilterNode(BaseAudioContext&, float sampleRate);
+    explicit BiquadFilterNode(BaseAudioContext&);
 
     BiquadProcessor* biquadProcessor() { return static_cast<BiquadProcessor*>(processor()); }
 };

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl	2020-08-05 16:52:17 UTC (rev 265290)
@@ -25,22 +25,10 @@
 
 [
     Conditional=WEB_AUDIO,
-    ImplementedAs=BiquadFilterType
-] enum BiquadFilterType {
-    "lowpass",
-    "highpass",
-    "bandpass",
-    "lowshelf",
-    "highshelf",
-    "peaking",
-    "notch",
-    "allpass"
-};
-
-[
-    Conditional=WEB_AUDIO,
     JSGenerateToJSObject,
 ] interface BiquadFilterNode : AudioNode {
+    [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional BiquadFilterOptions options);
+
     attribute BiquadFilterType type;
     
     readonly attribute AudioParam frequency; // in Hertz

Copied: trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.h (from rev 265289, trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl) (0 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.h	2020-08-05 16:52:17 UTC (rev 265290)
@@ -0,0 +1,44 @@
+/*
+ * 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"
+#include "BiquadFilterType.h"
+
+namespace WebCore {
+
+struct BiquadFilterOptions : AudioNodeOptions {
+    BiquadFilterType type { BiquadFilterType::Lowpass };
+    float Q { 1 };
+    float detune { 0 };
+    float frequency { 350 };
+    float gain { 0 };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)

Copied: trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.idl (from rev 265289, trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl) (0 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterOptions.idl	2020-08-05 16:52:17 UTC (rev 265290)
@@ -0,0 +1,33 @@
+/*
+ * 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 BiquadFilterOptions : AudioNodeOptions {
+    BiquadFilterType type = "lowpass";
+    float Q = 1;
+    float detune = 0;
+    float frequency = 350;
+    float gain = 0;
+};

Copied: trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.h (from rev 265289, trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl) (0 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.h	2020-08-05 16:52:17 UTC (rev 265290)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2016, 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 BiquadFilterType {
+    Lowpass,
+    Highpass,
+    Bandpass,
+    Lowshelf,
+    Highshelf,
+    Peaking,
+    Notch,
+    Allpass
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.idl (from rev 265289, trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl) (0 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterType.idl	2020-08-05 16:52:17 UTC (rev 265290)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2016, 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 BiquadFilterType {
+    "lowpass",
+    "highpass",
+    "bandpass",
+    "lowshelf",
+    "highshelf",
+    "peaking",
+    "notch",
+    "allpass"
+};

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp	2020-08-05 16:52:17 UTC (rev 265290)
@@ -35,21 +35,13 @@
 BiquadProcessor::BiquadProcessor(BaseAudioContext& context, float sampleRate, size_t numberOfChannels, bool autoInitialize)
     : AudioDSPKernelProcessor(sampleRate, numberOfChannels)
     , m_type(BiquadFilterType::Lowpass)
-    , m_parameter1(0)
-    , m_parameter2(0)
-    , m_parameter3(0)
-    , m_parameter4(0)
+    , m_parameter1(AudioParam::create(context, "frequency", 350.0, 10.0, 0.5 * sampleRate))
+    , m_parameter2(AudioParam::create(context, "Q", 1, 0.0001, 1000.0))
+    , m_parameter3(AudioParam::create(context, "gain", 0.0, -40, 40))
+    , m_parameter4(AudioParam::create(context, "detune", 0.0, -4800, 4800))
     , m_filterCoefficientsDirty(true)
     , m_hasSampleAccurateValues(false)
 {
-    double nyquist = 0.5 * this->sampleRate();
-
-    // Create parameters for BiquadFilterNode.
-    m_parameter1 = AudioParam::create(context, "frequency", 350.0, 10.0, nyquist);
-    m_parameter2 = AudioParam::create(context, "Q", 1, 0.0001, 1000.0);
-    m_parameter3 = AudioParam::create(context, "gain", 0.0, -40, 40);
-    m_parameter4 = AudioParam::create(context, "detune", 0.0, -4800, 4800);
-
     if (autoInitialize)
         initialize();
 }

Modified: trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h (265289 => 265290)


--- trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h	2020-08-05 16:52:17 UTC (rev 265290)
@@ -29,6 +29,7 @@
 #include "AudioNode.h"
 #include "AudioParam.h"
 #include "Biquad.h"
+#include "BiquadFilterType.h"
 #include <memory>
 #include <wtf/RefPtr.h>
 
@@ -36,17 +37,6 @@
 
 // BiquadProcessor is an AudioDSPKernelProcessor which uses Biquad objects to implement several common filters.
 
-enum class BiquadFilterType {
-    Lowpass,
-    Highpass,
-    Bandpass,
-    Lowshelf,
-    Highshelf,
-    Peaking,
-    Notch,
-    Allpass
-};
-
 class BiquadProcessor final : public AudioDSPKernelProcessor {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -70,10 +60,10 @@
     bool filterCoefficientsDirty() const { return m_filterCoefficientsDirty; }
     bool hasSampleAccurateValues() const { return m_hasSampleAccurateValues; }
 
-    AudioParam* parameter1() { return m_parameter1.get(); }
-    AudioParam* parameter2() { return m_parameter2.get(); }
-    AudioParam* parameter3() { return m_parameter3.get(); }
-    AudioParam* parameter4() { return m_parameter4.get(); }
+    AudioParam& parameter1() { return m_parameter1.get(); }
+    AudioParam& parameter2() { return m_parameter2.get(); }
+    AudioParam& parameter3() { return m_parameter3.get(); }
+    AudioParam& parameter4() { return m_parameter4.get(); }
 
     BiquadFilterType type() const { return m_type; }
     void setType(BiquadFilterType);
@@ -81,10 +71,10 @@
 private:
     BiquadFilterType m_type;
 
-    RefPtr<AudioParam> m_parameter1;
-    RefPtr<AudioParam> m_parameter2;
-    RefPtr<AudioParam> m_parameter3;
-    RefPtr<AudioParam> m_parameter4;
+    Ref<AudioParam> m_parameter1;
+    Ref<AudioParam> m_parameter2;
+    Ref<AudioParam> m_parameter3;
+    Ref<AudioParam> m_parameter4;
 
     // so DSP kernels know when to re-compute coefficients
     bool m_filterCoefficientsDirty;

Modified: trunk/Source/WebCore/Sources.txt (265289 => 265290)


--- trunk/Source/WebCore/Sources.txt	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/Sources.txt	2020-08-05 16:52:17 UTC (rev 265290)
@@ -2661,6 +2661,8 @@
 JSBeforeLoadEvent.cpp
 JSBeforeUnloadEvent.cpp
 JSBiquadFilterNode.cpp
+JSBiquadFilterOptions.cpp
+JSBiquadFilterType.cpp
 JSBlob.cpp
 JSBlobCallback.cpp
 JSBlobEvent.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265289 => 265290)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-05 16:36:43 UTC (rev 265289)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-05 16:52:17 UTC (rev 265290)
@@ -2516,6 +2516,8 @@
 		83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356446 /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		83D35AEC1C7187FA00F70D5A /* XMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */; };
 		83D35AF21C718D9000F70D5A /* JSXMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */; };
+		83DB9E0F24DA19490037B468 /* BiquadFilterType.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DB9E0C24DA18B50037B468 /* BiquadFilterType.h */; };
+		83DB9E1024DA19570037B468 /* BiquadFilterOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DB9E0E24DA18B60037B468 /* BiquadFilterOptions.h */; };
 		83E359A21BB1031D002CEB98 /* JSHTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */; };
 		83E866801FBA565B008855C5 /* ServiceWorkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E8667D1FBA563F008855C5 /* ServiceWorkerData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		83EE598F1F50958E003E8B30 /* JSErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE598B1F50958B003E8B30 /* JSErrorCallback.h */; };
@@ -10600,6 +10602,10 @@
 		83D35AEB1C7187ED00F70D5A /* XMLHttpRequestEventTarget.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequestEventTarget.idl; sourceTree = "<group>"; };
 		83D35AEF1C718D8400F70D5A /* JSXMLHttpRequestEventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestEventTarget.cpp; sourceTree = "<group>"; };
 		83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestEventTarget.h; sourceTree = "<group>"; };
+		83DB9E0A24DA18B40037B468 /* BiquadFilterType.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = BiquadFilterType.idl; sourceTree = "<group>"; };
+		83DB9E0C24DA18B50037B468 /* BiquadFilterType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BiquadFilterType.h; sourceTree = "<group>"; };
+		83DB9E0D24DA18B50037B468 /* BiquadFilterOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = BiquadFilterOptions.idl; sourceTree = "<group>"; };
+		83DB9E0E24DA18B60037B468 /* BiquadFilterOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BiquadFilterOptions.h; sourceTree = "<group>"; };
 		83E045EC1DAA104F00B0D8B9 /* JSEventModifierInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventModifierInit.cpp; sourceTree = "<group>"; };
 		83E045ED1DAA104F00B0D8B9 /* JSEventModifierInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventModifierInit.h; sourceTree = "<group>"; };
 		83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUIEventInit.cpp; sourceTree = "<group>"; };
@@ -29557,6 +29563,10 @@
 				FDC54F011399B0DA008D9117 /* BiquadFilterNode.cpp */,
 				FDC54F021399B0DA008D9117 /* BiquadFilterNode.h */,
 				FDC54F031399B0DA008D9117 /* BiquadFilterNode.idl */,
+				83DB9E0E24DA18B60037B468 /* BiquadFilterOptions.h */,
+				83DB9E0D24DA18B50037B468 /* BiquadFilterOptions.idl */,
+				83DB9E0C24DA18B50037B468 /* BiquadFilterType.h */,
+				83DB9E0A24DA18B40037B468 /* BiquadFilterType.idl */,
 				FD315FDC12B0267600C1A359 /* BiquadProcessor.cpp */,
 				FD315FDD12B0267600C1A359 /* BiquadProcessor.h */,
 				E785D91124B4D1B10014DB21 /* ChannelCountMode.h */,
@@ -30180,6 +30190,8 @@
 				FD31608D12B026F700C1A359 /* Biquad.h in Headers */,
 				FD31602512B0267600C1A359 /* BiquadDSPKernel.h in Headers */,
 				FDC54F051399B0DA008D9117 /* BiquadFilterNode.h in Headers */,
+				83DB9E1024DA19570037B468 /* BiquadFilterOptions.h in Headers */,
+				83DB9E0F24DA19490037B468 /* BiquadFilterType.h in Headers */,
 				FD31602712B0267600C1A359 /* BiquadProcessor.h in Headers */,
 				A89943280B42338800D7C802 /* BitmapImage.h in Headers */,
 				976D6C79122B8A3D001FD1F7 /* Blob.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to