Title: [265336] trunk
Revision
265336
Author
cdu...@apple.com
Date
2020-08-06 10:33:40 -0700 (Thu, 06 Aug 2020)

Log Message

DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam
https://bugs.webkit.org/show_bug.cgi?id=215195

Reviewed by Youenn Fablet.

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-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt:

Source/WebCore:

DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam:
- https://webaudio.github.io/web-audio-api/#dynamicscompressornode

Backward-compatibility is maintained for the prefixed WebAudio API.

No new tests, rebaselined existing tests.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webaudio/DynamicsCompressorNode.cpp:
(WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
(WebCore::DynamicsCompressorNode::process):
* Modules/webaudio/DynamicsCompressorNode.h:
(WebCore::DynamicsCompressorNode::reduction const):
(WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
(WebCore::DynamicsCompressorNode::setReduction):
* Modules/webaudio/DynamicsCompressorNode.idl:
* Modules/webaudio/WebKitAudioContext.cpp:
(WebCore::WebKitAudioContext::createWebKitDynamicsCompressor):
* Modules/webaudio/WebKitAudioContext.h:
* Modules/webaudio/WebKitAudioContext.idl:
* Modules/webaudio/WebKitDynamicsCompressorNode.h: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl.
* Modules/webaudio/WebKitDynamicsCompressorNode.idl: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265335 => 265336)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-06 17:33:40 UTC (rev 265336)
@@ -1,5 +1,18 @@
 2020-08-06  Chris Dumez  <cdu...@apple.com>
 
+        DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam
+        https://bugs.webkit.org/show_bug.cgi?id=215195
+
+        Reviewed by Youenn Fablet.
+
+        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-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt:
+
+2020-08-06  Chris Dumez  <cdu...@apple.com>
+
         MediaElementAudioSourceNode interface should have a constructor
         https://bugs.webkit.org/show_bug.cgi?id=215200
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-06 17:33:40 UTC (rev 265336)
@@ -695,7 +695,7 @@
 PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "threshold" with the proper type 
 PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "knee" with the proper type 
 PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "ratio" with the proper type 
-FAIL DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "reduction" with the proper type assert_equals: expected "number" but got "object"
+PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "reduction" with the proper type 
 PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "attack" with the proper type 
 PASS DynamicsCompressorNode interface: new DynamicsCompressorNode(context) must inherit property "release" with the proper type 
 PASS AudioNode interface: new DynamicsCompressorNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt (265335 => 265336)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt	2020-08-06 17:33:40 UTC (rev 265336)
@@ -25,7 +25,7 @@
 PASS   node0.threshold.value is equal to -24. 
 PASS   node0.knee.value is equal to 30. 
 PASS   node0.ratio.value is equal to 12. 
-PASS   node0.reduction.value is equal to 0. 
+PASS   node0.reduction is equal to 0. 
 PASS   node0.attack.value is equal to 0.003000000026077032. 
 PASS   node0.release.value is equal to 0.25. 
 PASS < [default constructor] All assertions passed. (total 13 assertions) 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt (265335 => 265336)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt	2020-08-06 17:33:40 UTC (rev 265336)
@@ -8,8 +8,8 @@
 PASS   compressor.ratio.value is equal to 12. 
 PASS   compressor.attack.value is equal to 0.003000000026077032. 
 PASS   compressor.release.value is equal to 0.25. 
-FAIL X typeof compressor.reduction is not equal to number. Got object. assert_true: expected true got false
-FAIL X compressor.reduction is not equal to 0. Got AudioParam. assert_true: expected true got false
-FAIL < [test] 2 out of 7 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false
+PASS   typeof compressor.reduction is equal to number. 
+PASS   compressor.reduction is equal to 0. 
+PASS < [test] All assertions passed. (total 7 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/CMakeLists.txt (265335 => 265336)


--- trunk/Source/WebCore/CMakeLists.txt	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-08-06 17:33:40 UTC (rev 265336)
@@ -507,6 +507,7 @@
     Modules/webaudio/WebKitAudioContext.idl
     Modules/webaudio/WebKitAudioListener.idl
     Modules/webaudio/WebKitAudioPannerNode.idl
+    Modules/webaudio/WebKitDynamicsCompressorNode.idl
     Modules/webaudio/WebKitOfflineAudioContext.idl
     Modules/webaudio/WebKitOscillatorNode.idl
 

Modified: trunk/Source/WebCore/ChangeLog (265335 => 265336)


--- trunk/Source/WebCore/ChangeLog	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/ChangeLog	2020-08-06 17:33:40 UTC (rev 265336)
@@ -1,3 +1,38 @@
+2020-08-06  Chris Dumez  <cdu...@apple.com>
+
+        DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam
+        https://bugs.webkit.org/show_bug.cgi?id=215195
+
+        Reviewed by Youenn Fablet.
+
+        DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam:
+        - https://webaudio.github.io/web-audio-api/#dynamicscompressornode
+
+        Backward-compatibility is maintained for the prefixed WebAudio API.
+
+        No new tests, rebaselined existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webaudio/DynamicsCompressorNode.cpp:
+        (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
+        (WebCore::DynamicsCompressorNode::process):
+        * Modules/webaudio/DynamicsCompressorNode.h:
+        (WebCore::DynamicsCompressorNode::reduction const):
+        (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
+        (WebCore::DynamicsCompressorNode::setReduction):
+        * Modules/webaudio/DynamicsCompressorNode.idl:
+        * Modules/webaudio/WebKitAudioContext.cpp:
+        (WebCore::WebKitAudioContext::createWebKitDynamicsCompressor):
+        * Modules/webaudio/WebKitAudioContext.h:
+        * Modules/webaudio/WebKitAudioContext.idl:
+        * Modules/webaudio/WebKitDynamicsCompressorNode.h: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl.
+        * Modules/webaudio/WebKitDynamicsCompressorNode.idl: Copied from Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2020-08-06  Truitt Savell  <tsav...@apple.com>
 
         Unreviewed, reverting r265328.

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265335 => 265336)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-08-06 17:33:40 UTC (rev 265336)
@@ -356,6 +356,7 @@
 $(PROJECT_DIR)/Modules/webaudio/WebKitAudioContext.idl
 $(PROJECT_DIR)/Modules/webaudio/WebKitAudioListener.idl
 $(PROJECT_DIR)/Modules/webaudio/WebKitAudioPannerNode.idl
+$(PROJECT_DIR)/Modules/webaudio/WebKitDynamicsCompressorNode.idl
 $(PROJECT_DIR)/Modules/webaudio/WebKitOfflineAudioContext.idl
 $(PROJECT_DIR)/Modules/webaudio/WebKitOscillatorNode.idl
 $(PROJECT_DIR)/Modules/webauthn/AttestationConveyancePreference.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265335 => 265336)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-08-06 17:33:40 UTC (rev 265336)
@@ -2152,6 +2152,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitCSSMatrix.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitDynamicsCompressorNode.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitDynamicsCompressorNode.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitMediaKeyError.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitMediaKeyError.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitMediaKeyMessageEvent.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (265335 => 265336)


--- trunk/Source/WebCore/DerivedSources.make	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/DerivedSources.make	2020-08-06 17:33:40 UTC (rev 265336)
@@ -439,6 +439,7 @@
     $(WebCore)/Modules/webaudio/WebKitAudioContext.idl \
     $(WebCore)/Modules/webaudio/WebKitAudioListener.idl \
     $(WebCore)/Modules/webaudio/WebKitAudioPannerNode.idl \
+    $(WebCore)/Modules/webaudio/WebKitDynamicsCompressorNode.idl \
     $(WebCore)/Modules/webaudio/WebKitOfflineAudioContext.idl \
     $(WebCore)/Modules/webaudio/WebKitOscillatorNode.idl \
     $(WebCore)/Modules/webauthn/AttestationConveyancePreference.idl \

Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp	2020-08-06 17:33:40 UTC (rev 265336)
@@ -33,6 +33,7 @@
 #include "AudioNodeInput.h"
 #include "AudioNodeOutput.h"
 #include "DynamicsCompressor.h"
+#include "WebKitDynamicsCompressorNode.h"
 #include <wtf/IsoMallocInlines.h>
 
 // Set output to stereo by default.
@@ -41,6 +42,7 @@
 namespace WebCore {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(DynamicsCompressorNode);
+WTF_MAKE_ISO_ALLOCATED_IMPL(WebKitDynamicsCompressorNode);
 
 ExceptionOr<Ref<DynamicsCompressorNode>> DynamicsCompressorNode::create(BaseAudioContext& context, const DynamicsCompressorOptions& options)
 {
@@ -63,7 +65,6 @@
     , m_threshold(AudioParam::create(context, "threshold"_s, options.threshold, -100, 0))
     , m_knee(AudioParam::create(context, "knee"_s, options.knee, 0, 40))
     , m_ratio(AudioParam::create(context, "ratio"_s, options.ratio, 1, 20))
-    , m_reduction(AudioParam::create(context, "reduction"_s, 0, -20, 0))
     , m_attack(AudioParam::create(context, "attack"_s, options.attack, 0, 1))
     , m_release(AudioParam::create(context, "release"_s, options.release, 0, 1))
 {
@@ -99,8 +100,7 @@
 
     m_dynamicsCompressor->process(input(0)->bus(), outputBus, framesToProcess);
 
-    float reduction = m_dynamicsCompressor->parameterValue(DynamicsCompressor::ParamReduction);
-    m_reduction->setValue(reduction);
+    setReduction(m_dynamicsCompressor->parameterValue(DynamicsCompressor::ParamReduction));
 }
 
 void DynamicsCompressorNode::reset()

Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.h (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.h	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.h	2020-08-06 17:33:40 UTC (rev 265336)
@@ -34,7 +34,7 @@
 
 class DynamicsCompressor;
 
-class DynamicsCompressorNode final : public AudioNode {
+class DynamicsCompressorNode : public AudioNode {
     WTF_MAKE_ISO_ALLOCATED(DynamicsCompressorNode);
 public:
     static ExceptionOr<Ref<DynamicsCompressorNode>> create(BaseAudioContext&, const DynamicsCompressorOptions& = { });
@@ -55,24 +55,26 @@
     AudioParam& release() { return m_release.get(); }
 
     // Amount by which the compressor is currently compressing the signal in decibels.
-    AudioParam& reduction() { return m_reduction.get(); }
+    float reduction() const { return m_reduction; }
 
     ExceptionOr<void> setChannelCount(unsigned) final;
     ExceptionOr<void> setChannelCountMode(ChannelCountMode) final;
 
+protected:
+    explicit DynamicsCompressorNode(BaseAudioContext&, const DynamicsCompressorOptions& = { });
+    virtual void setReduction(float reduction) { m_reduction = reduction; }
+
 private:
     double tailTime() const override;
     double latencyTime() const override;
 
-    DynamicsCompressorNode(BaseAudioContext&, const DynamicsCompressorOptions&);
-
     std::unique_ptr<DynamicsCompressor> m_dynamicsCompressor;
     Ref<AudioParam> m_threshold;
     Ref<AudioParam> m_knee;
     Ref<AudioParam> m_ratio;
-    Ref<AudioParam> m_reduction;
     Ref<AudioParam> m_attack;
     Ref<AudioParam> m_release;
+    float m_reduction { 0 };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl	2020-08-06 17:33:40 UTC (rev 265336)
@@ -35,6 +35,5 @@
     readonly attribute AudioParam attack; // in Seconds
     readonly attribute AudioParam release; // in Seconds
 
-    // FIXME: The following attribute should use float type.
-    readonly attribute AudioParam reduction; // in Decibels
+    readonly attribute float reduction; // in Decibels
 };

Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp	2020-08-06 17:33:40 UTC (rev 265336)
@@ -33,6 +33,7 @@
 #include "PeriodicWave.h"
 #include "WebKitAudioBufferSourceNode.h"
 #include "WebKitAudioPannerNode.h"
+#include "WebKitDynamicsCompressorNode.h"
 #include "WebKitOscillatorNode.h"
 #include <wtf/IsoMallocInlines.h>
 
@@ -216,6 +217,16 @@
     return node;
 }
 
+ExceptionOr<Ref<WebKitDynamicsCompressorNode>> WebKitAudioContext::createWebKitDynamicsCompressor()
+{
+    if (isStopped())
+        return Exception { InvalidStateError };
+
+    lazyInitialize();
+
+    return WebKitDynamicsCompressorNode::create(*this);
+}
+
 void WebKitAudioContext::close(DOMPromiseDeferred<void>&& promise)
 {
     if (isOfflineContext() || isStopped()) {

Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h	2020-08-06 17:33:40 UTC (rev 265336)
@@ -40,6 +40,7 @@
 class PeriodicWave;
 class WebKitAudioBufferSourceNode;
 class WebKitAudioPannerNode;
+class WebKitDynamicsCompressorNode;
 class WebKitOscillatorNode;
 
 // AudioContext is the cornerstone of the web audio API and all AudioNodes are created from it.
@@ -69,6 +70,7 @@
     ExceptionOr<Ref<WebKitOscillatorNode>> createWebKitOscillator();
     ExceptionOr<Ref<PeriodicWave>> createPeriodicWave(Float32Array& real, Float32Array& imaginary);
     ExceptionOr<Ref<WebKitAudioBufferSourceNode>> createWebKitBufferSource();
+    ExceptionOr<Ref<WebKitDynamicsCompressorNode>> createWebKitDynamicsCompressor();
 
 protected:
     explicit WebKitAudioContext(Document&);

Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl (265335 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl	2020-08-06 17:33:40 UTC (rev 265336)
@@ -76,7 +76,7 @@
     [MayThrowException] WaveShaperNode createWaveShaper();
     [MayThrowException, ImplementedAs=createWebKitPanner] WebKitAudioPannerNode createPanner();
     [MayThrowException] ConvolverNode createConvolver();
-    [MayThrowException] DynamicsCompressorNode createDynamicsCompressor();
+    [MayThrowException, ImplementedAs=createWebKitDynamicsCompressor] WebKitDynamicsCompressorNode createDynamicsCompressor();
     [MayThrowException] AnalyserNode createAnalyser();
     [MayThrowException] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2);
     [MayThrowException, ImplementedAs=createWebKitOscillator] WebKitOscillatorNode createOscillator();

Copied: trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.h (from rev 265335, trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl) (0 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.h	2020-08-06 17:33:40 UTC (rev 265336)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DynamicsCompressorNode.h"
+
+namespace WebCore {
+
+class WebKitDynamicsCompressorNode final : public DynamicsCompressorNode {
+    WTF_MAKE_ISO_ALLOCATED(WebKitDynamicsCompressorNode);
+public:
+    static Ref<WebKitDynamicsCompressorNode> create(WebKitAudioContext& context)
+    {
+        return adoptRef(*new WebKitDynamicsCompressorNode(context));
+    }
+
+    AudioParam& legacyReduction() { return m_legacyReduction.get(); }
+
+private:
+    explicit WebKitDynamicsCompressorNode(WebKitAudioContext& context)
+        : DynamicsCompressorNode(context)
+        , m_legacyReduction(AudioParam::create(context, "reduction"_s, 0, -20, 0))
+    {
+        initializeDefaultNodeOptions(2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers);
+    }
+
+    void setReduction(float reduction) final
+    {
+        DynamicsCompressorNode::setReduction(reduction);
+        m_legacyReduction->setValue(reduction);
+    }
+
+    Ref<AudioParam> m_legacyReduction;
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.idl (from rev 265335, trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl) (0 => 265336)


--- trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitDynamicsCompressorNode.idl	2020-08-06 17:33:40 UTC (rev 265336)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2011, Google Inc. All rights reserved.
+ * 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,
+    EnabledBySetting=PrefixedWebAudio,
+    JSGenerateToJSObject,
+    NoInterfaceObject
+] interface WebKitDynamicsCompressorNode : AudioNode {
+    readonly attribute AudioParam threshold; // in Decibels
+    readonly attribute AudioParam knee; // in Decibels
+    readonly attribute AudioParam ratio; // unit-less
+    readonly attribute AudioParam attack; // in Seconds
+    readonly attribute AudioParam release; // in Seconds
+    [ImplementedAs=legacyReduction] readonly attribute AudioParam reduction; // in Decibels
+};

Modified: trunk/Source/WebCore/Sources.txt (265335 => 265336)


--- trunk/Source/WebCore/Sources.txt	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/Sources.txt	2020-08-06 17:33:40 UTC (rev 265336)
@@ -3580,6 +3580,7 @@
 JSWebKitAudioListener.cpp
 JSWebKitAudioPannerNode.cpp
 JSWebKitCSSMatrix.cpp
+JSWebKitDynamicsCompressorNode.cpp
 JSWebKitMediaKeyError.cpp
 JSWebKitMediaKeyMessageEvent.cpp
 JSWebKitMediaKeyNeededEvent.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265335 => 265336)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-06 17:32:17 UTC (rev 265335)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-06 17:33:40 UTC (rev 265336)
@@ -2431,6 +2431,7 @@
 		830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 830784B11C52EE1900104D1D /* XMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		830A1C7D24DB788B002ECCAD /* MediaElementAudioSourceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A1C7C24DB7870002ECCAD /* MediaElementAudioSourceOptions.h */; };
 		830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */; };
+		830EEABA24DB6A64009EFBCE /* WebKitDynamicsCompressorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 830EEAB724DB6A52009EFBCE /* WebKitDynamicsCompressorNode.h */; };
 		83102B271F9EADD900E404B9 /* JSExtendableMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 83102B231F9EADC200E404B9 /* JSExtendableMessageEvent.h */; };
 		8311C0031FAA2E9500E3C8E5 /* SWServerJobQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8311C0021FAA2E8900E3C8E5 /* SWServerJobQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		83120C711C56F3FB001CB112 /* HTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A71C56E83A00F3F0E3 /* HTMLDataElement.h */; };
@@ -10426,6 +10427,8 @@
 		830A1C7C24DB7870002ECCAD /* MediaElementAudioSourceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaElementAudioSourceOptions.h; sourceTree = "<group>"; };
 		830A36BA1DAC5FA7006D7D09 /* JSMouseEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEventInit.cpp; sourceTree = "<group>"; };
 		830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMouseEventInit.h; sourceTree = "<group>"; };
+		830EEAB724DB6A52009EFBCE /* WebKitDynamicsCompressorNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitDynamicsCompressorNode.h; sourceTree = "<group>"; };
+		830EEAB924DB6A52009EFBCE /* WebKitDynamicsCompressorNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitDynamicsCompressorNode.idl; sourceTree = "<group>"; };
 		83102B231F9EADC200E404B9 /* JSExtendableMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExtendableMessageEvent.h; sourceTree = "<group>"; };
 		83102B251F9EADC200E404B9 /* JSExtendableMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExtendableMessageEvent.cpp; sourceTree = "<group>"; };
 		8311C0001FAA2E8900E3C8E5 /* SWServerJobQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWServerJobQueue.cpp; sourceTree = "<group>"; };
@@ -29693,6 +29696,8 @@
 				831B61712499A59900C07C79 /* WebKitAudioPannerNode.cpp */,
 				831B61742499A59C00C07C79 /* WebKitAudioPannerNode.h */,
 				831B616F2499A59800C07C79 /* WebKitAudioPannerNode.idl */,
+				830EEAB724DB6A52009EFBCE /* WebKitDynamicsCompressorNode.h */,
+				830EEAB924DB6A52009EFBCE /* WebKitDynamicsCompressorNode.idl */,
 				831B61732499A59B00C07C79 /* WebKitOfflineAudioContext.cpp */,
 				831B61752499A59D00C07C79 /* WebKitOfflineAudioContext.h */,
 				831B61722499A59A00C07C79 /* WebKitOfflineAudioContext.idl */,
@@ -34146,6 +34151,7 @@
 				831B61762499A5BB00C07C79 /* WebKitAudioPannerNode.h in Headers */,
 				5DFEBAB718592B6D00C75BEB /* WebKitAvailability.h in Headers */,
 				498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */,
+				830EEABA24DB6A64009EFBCE /* WebKitDynamicsCompressorNode.h in Headers */,
 				2D0621451DA639BA00A7FB26 /* WebKitMediaKeyMessageEvent.h in Headers */,
 				2D0621511DA63A9F00A7FB26 /* WebKitMediaKeyNeededEvent.h in Headers */,
 				2D06214E1DA63A8E00A7FB26 /* WebKitMediaKeys.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to