mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Add scaffolding for DynamicsCompressorNode
This commit is contained in:
parent
e2336e2099
commit
2a56df8ecd
Notes:
sideshowbarker
2024-07-17 06:09:44 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/2a56df8ecd Pull-request: https://github.com/SerenityOS/serenity/pull/24215
@ -46,6 +46,7 @@ static bool is_platform_object(Type const& type)
|
||||
"Document"sv,
|
||||
"DocumentType"sv,
|
||||
"DOMRectReadOnly"sv,
|
||||
"DynamicsCompressorNode"sv,
|
||||
"EventTarget"sv,
|
||||
"FileList"sv,
|
||||
"FontFace"sv,
|
||||
|
@ -665,6 +665,7 @@ set(SOURCES
|
||||
WebAudio/AudioParam.cpp
|
||||
WebAudio/AudioScheduledSourceNode.cpp
|
||||
WebAudio/BaseAudioContext.cpp
|
||||
WebAudio/DynamicsCompressorNode.cpp
|
||||
WebAudio/OfflineAudioContext.cpp
|
||||
WebAudio/OscillatorNode.cpp
|
||||
WebAudio/PeriodicWave.cpp
|
||||
|
@ -689,6 +689,7 @@ class AudioNode;
|
||||
class AudioParam;
|
||||
class AudioScheduledSourceNode;
|
||||
class BaseAudioContext;
|
||||
class DynamicsCompressorNode;
|
||||
class OfflineAudioContext;
|
||||
class OscillatorNode;
|
||||
class PeriodicWave;
|
||||
@ -696,6 +697,8 @@ class PeriodicWave;
|
||||
enum class AudioContextState;
|
||||
|
||||
struct AudioContextOptions;
|
||||
struct DynamicsCompressorOptions;
|
||||
struct OscillatorOptions;
|
||||
}
|
||||
|
||||
namespace Web::WebGL {
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/DynamicsCompressorNodePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/WebAudio/DynamicsCompressorNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DynamicsCompressorNode);
|
||||
|
||||
DynamicsCompressorNode::~DynamicsCompressorNode() = default;
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> DynamicsCompressorNode::create(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, DynamicsCompressorOptions const& options)
|
||||
{
|
||||
return construct_impl(realm, context, options);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-dynamicscompressornode-dynamicscompressornode
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> DynamicsCompressorNode::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, DynamicsCompressorOptions const& options)
|
||||
{
|
||||
// FIXME: Invoke "Initialize the AudioNode" steps.
|
||||
return realm.vm().heap().allocate<DynamicsCompressorNode>(realm, realm, context, options);
|
||||
}
|
||||
|
||||
DynamicsCompressorNode::DynamicsCompressorNode(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, DynamicsCompressorOptions const&)
|
||||
: AudioNode(realm, context)
|
||||
{
|
||||
}
|
||||
|
||||
void DynamicsCompressorNode::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(DynamicsCompressorNode);
|
||||
}
|
||||
|
||||
void DynamicsCompressorNode::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
}
|
||||
|
||||
}
|
40
Userland/Libraries/LibWeb/WebAudio/DynamicsCompressorNode.h
Normal file
40
Userland/Libraries/LibWeb/WebAudio/DynamicsCompressorNode.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/WebAudio/AudioNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#DynamicsCompressorOptions
|
||||
struct DynamicsCompressorOptions : AudioNodeOptions {
|
||||
float attack { 0.003 };
|
||||
float knee { 30 };
|
||||
float ratio { 12 };
|
||||
float release { 0.25 };
|
||||
float threshold { -24 };
|
||||
};
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#DynamicsCompressorNode
|
||||
class DynamicsCompressorNode : public AudioNode {
|
||||
WEB_PLATFORM_OBJECT(DynamicsCompressorNode, AudioNode);
|
||||
JS_DECLARE_ALLOCATOR(DynamicsCompressorNode);
|
||||
|
||||
public:
|
||||
virtual ~DynamicsCompressorNode() override;
|
||||
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {});
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {});
|
||||
|
||||
protected:
|
||||
DynamicsCompressorNode(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {});
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#import <WebAudio/AudioNode.idl>
|
||||
#import <WebAudio/AudioParam.idl>
|
||||
#import <WebAudio/BaseAudioContext.idl>
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#DynamicsCompressorOptions
|
||||
dictionary DynamicsCompressorOptions : AudioNodeOptions {
|
||||
float attack = 0.003;
|
||||
float knee = 30;
|
||||
float ratio = 12;
|
||||
float release = 0.25;
|
||||
float threshold = -24;
|
||||
};
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#DynamicsCompressorNode
|
||||
[Exposed=Window]
|
||||
interface DynamicsCompressorNode : AudioNode {
|
||||
constructor(BaseAudioContext context,
|
||||
optional DynamicsCompressorOptions options = {});
|
||||
// FIXME: readonly attribute AudioParam threshold;
|
||||
// FIXME: readonly attribute AudioParam knee;
|
||||
// FIXME: readonly attribute AudioParam ratio;
|
||||
// FIXME: readonly attribute float reduction;
|
||||
// FIXME: readonly attribute AudioParam attack;
|
||||
// FIXME: readonly attribute AudioParam release;
|
||||
};
|
@ -301,6 +301,7 @@ libweb_js_bindings(WebAudio/AudioNode)
|
||||
libweb_js_bindings(WebAudio/AudioParam)
|
||||
libweb_js_bindings(WebAudio/AudioScheduledSourceNode)
|
||||
libweb_js_bindings(WebAudio/BaseAudioContext)
|
||||
libweb_js_bindings(WebAudio/DynamicsCompressorNode)
|
||||
libweb_js_bindings(WebAudio/OfflineAudioContext)
|
||||
libweb_js_bindings(WebAudio/OscillatorNode)
|
||||
libweb_js_bindings(WebAudio/PeriodicWave)
|
||||
|
Loading…
Reference in New Issue
Block a user