- Revision
- 265291
- Author
- cdu...@apple.com
- Date
- 2020-08-05 09:54:48 -0700 (Wed, 05 Aug 2020)
Log Message
Align BiquadFilterNode.getFrequencyResponse() with the specification
https://bugs.webkit.org/show_bug.cgi?id=215148
Reviewed by Eric Carlson.
LayoutTests/imported/w3c:
Rebaseline WPT tests now that all checks are passing.
* web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic-expected.txt:
Source/WebCore:
Align BiquadFilterNode.getFrequencyResponse() with the specification:
- https://webaudio.github.io/web-audio-api/#dom-biquadfilternode-getfrequencyresponse
In particular, the 3 argument arrays should not be nullable and we should throw
if they have different lengths.
No new tests, rebaselined existing tests.
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::getFrequencyResponse):
* Modules/webaudio/BiquadFilterNode.h:
* Modules/webaudio/BiquadFilterNode.idl:
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265290 => 265291)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-05 16:54:48 UTC (rev 265291)
@@ -1,5 +1,16 @@
2020-08-05 Chris Dumez <cdu...@apple.com>
+ Align BiquadFilterNode.getFrequencyResponse() with the specification
+ https://bugs.webkit.org/show_bug.cgi?id=215148
+
+ Reviewed by Eric Carlson.
+
+ Rebaseline WPT tests now that all checks are passing.
+
+ * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic-expected.txt:
+
+2020-08-05 Chris Dumez <cdu...@apple.com>
+
Add constructor to BiquadFilterNode
https://bugs.webkit.org/show_bug.cgi?id=215144
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic-expected.txt (265290 => 265291)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic-expected.txt 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-basic-expected.txt 2020-08-05 16:54:48 UTC (rev 265291)
@@ -22,11 +22,11 @@
PASS createBiquadFilter() did not throw an exception.
PASS < [exceptions-createBiquadFilter] All assertions passed. (total 1 assertions)
PASS > [exceptions-getFrequencyData]
-FAIL X getFrequencyResponse(null, new Float32Array(1), new Float32Array(1)) did not throw an exception. assert_true: expected true got false
-FAIL X getFrequencyResponse(new Float32Array(1), null, new Float32Array(1)) did not throw an exception. assert_true: expected true got false
-FAIL X getFrequencyResponse(new Float32Array(1), new Float32Array(1), null) did not throw an exception. assert_true: expected true got false
-FAIL X getFrequencyResponse(new Float32Array(10), new Float32Array(1), new Float32Array(20)) did not throw an exception. assert_true: expected true got false
-FAIL X getFrequencyResponse(new Float32Array(10), new Float32Array(20), new Float32Array(1)) did not throw an exception. assert_true: expected true got false
-FAIL < [exceptions-getFrequencyData] 5 out of 5 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 5 tasks were failed. assert_true: expected true got false
+PASS getFrequencyResponse(null, new Float32Array(1), new Float32Array(1)) threw TypeError: "Argument 1 ('frequencyHz') to BiquadFilterNode.getFrequencyResponse must be an instance of Float32Array".
+PASS getFrequencyResponse(new Float32Array(1), null, new Float32Array(1)) threw TypeError: "Argument 2 ('magResponse') to BiquadFilterNode.getFrequencyResponse must be an instance of Float32Array".
+PASS getFrequencyResponse(new Float32Array(1), new Float32Array(1), null) threw TypeError: "Argument 3 ('phaseResponse') to BiquadFilterNode.getFrequencyResponse must be an instance of Float32Array".
+PASS getFrequencyResponse(new Float32Array(10), new Float32Array(1), new Float32Array(20)) threw InvalidStateError: "The arrays passed as arguments must have the same length".
+PASS getFrequencyResponse(new Float32Array(10), new Float32Array(20), new Float32Array(1)) threw InvalidStateError: "The arrays passed as arguments must have the same length".
+PASS < [exceptions-getFrequencyData] All assertions passed. (total 5 assertions)
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully.
Modified: trunk/Source/WebCore/ChangeLog (265290 => 265291)
--- trunk/Source/WebCore/ChangeLog 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/Source/WebCore/ChangeLog 2020-08-05 16:54:48 UTC (rev 265291)
@@ -1,5 +1,25 @@
2020-08-05 Chris Dumez <cdu...@apple.com>
+ Align BiquadFilterNode.getFrequencyResponse() with the specification
+ https://bugs.webkit.org/show_bug.cgi?id=215148
+
+ Reviewed by Eric Carlson.
+
+ Align BiquadFilterNode.getFrequencyResponse() with the specification:
+ - https://webaudio.github.io/web-audio-api/#dom-biquadfilternode-getfrequencyresponse
+
+ In particular, the 3 argument arrays should not be nullable and we should throw
+ if they have different lengths.
+
+ No new tests, rebaselined existing tests.
+
+ * Modules/webaudio/BiquadFilterNode.cpp:
+ (WebCore::BiquadFilterNode::getFrequencyResponse):
+ * Modules/webaudio/BiquadFilterNode.h:
+ * Modules/webaudio/BiquadFilterNode.idl:
+
+2020-08-05 Chris Dumez <cdu...@apple.com>
+
Add constructor to BiquadFilterNode
https://bugs.webkit.org/show_bug.cgi?id=215144
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp (265290 => 265291)
--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.cpp 2020-08-05 16:54:48 UTC (rev 265291)
@@ -82,15 +82,15 @@
biquadProcessor()->setType(type);
}
-void BiquadFilterNode::getFrequencyResponse(const RefPtr<Float32Array>& frequencyHz, const RefPtr<Float32Array>& magResponse, const RefPtr<Float32Array>& phaseResponse)
+ExceptionOr<void> BiquadFilterNode::getFrequencyResponse(const Ref<Float32Array>& frequencyHz, const Ref<Float32Array>& magResponse, const Ref<Float32Array>& phaseResponse)
{
- if (!frequencyHz || !magResponse || !phaseResponse)
- return;
-
- int n = std::min(frequencyHz->length(), std::min(magResponse->length(), phaseResponse->length()));
+ auto length = frequencyHz->length();
+ if (magResponse->length() != length || phaseResponse->length() != length)
+ return Exception { InvalidStateError, "The arrays passed as arguments must have the same length" };
- if (n)
- biquadProcessor()->getFrequencyResponse(n, frequencyHz->data(), magResponse->data(), phaseResponse->data());
+ if (length)
+ biquadProcessor()->getFrequencyResponse(length, frequencyHz->data(), magResponse->data(), phaseResponse->data());
+ return { };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h (265290 => 265291)
--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.h 2020-08-05 16:54:48 UTC (rev 265291)
@@ -47,7 +47,7 @@
// Get the magnitude and phase response of the filter at the given
// set of frequencies (in Hz). The phase response is in radians.
- void getFrequencyResponse(const RefPtr<Float32Array>& frequencyHz, const RefPtr<Float32Array>& magResponse, const RefPtr<Float32Array>& phaseResponse);
+ ExceptionOr<void> getFrequencyResponse(const Ref<Float32Array>& frequencyHz, const Ref<Float32Array>& magResponse, const Ref<Float32Array>& phaseResponse);
private:
explicit BiquadFilterNode(BaseAudioContext&);
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl (265290 => 265291)
--- trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl 2020-08-05 16:52:17 UTC (rev 265290)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl 2020-08-05 16:54:48 UTC (rev 265291)
@@ -36,6 +36,5 @@
readonly attribute AudioParam Q; // Quality factor
readonly attribute AudioParam gain; // in Decibels
- // FIXME: the parameters should not be nullable.
- void getFrequencyResponse(Float32Array? frequencyHz, Float32Array? magResponse, Float32Array? phaseResponse);
+ [MayThrowException] void getFrequencyResponse(Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse);
};