mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 05:52:53 +00:00
This is still missing a bunch of spec steps to construct the audio node based on the parameters of the OscillatorNode, but it is at least enough to construct an object to be able to add a basic test which can get built upon as more is implemented.
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/Bindings/OscillatorNodePrototype.h>
|
|
#include <LibWeb/WebAudio/OscillatorNode.h>
|
|
|
|
namespace Web::WebAudio {
|
|
|
|
JS_DEFINE_ALLOCATOR(OscillatorNode);
|
|
|
|
OscillatorNode::~OscillatorNode() = default;
|
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> OscillatorNode::create(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, OscillatorOptions const& options)
|
|
{
|
|
return construct_impl(realm, context, options);
|
|
}
|
|
|
|
// https://webaudio.github.io/web-audio-api/#dom-oscillatornode-oscillatornode
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> OscillatorNode::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, OscillatorOptions const& options)
|
|
{
|
|
// FIXME: Invoke "Initialize the AudioNode" steps.
|
|
return realm.vm().heap().allocate<OscillatorNode>(realm, realm, context, options);
|
|
}
|
|
|
|
OscillatorNode::OscillatorNode(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> context, OscillatorOptions const&)
|
|
: AudioScheduledSourceNode(realm, context)
|
|
{
|
|
}
|
|
|
|
void OscillatorNode::initialize(JS::Realm& realm)
|
|
{
|
|
Base::initialize(realm);
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(OscillatorNode);
|
|
}
|
|
|
|
void OscillatorNode::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
}
|
|
|
|
}
|