mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibWeb: Add stub IDL interface for AudioScheduledSourceNode
This is a base class of a few different audio nodes, most notably for our immediate needs - OscillatorNode.
This commit is contained in:
parent
6661c68b28
commit
c9b2c1c747
7 changed files with 101 additions and 0 deletions
|
@ -35,6 +35,7 @@ static bool is_platform_object(Type const& type)
|
|||
"Attr"sv,
|
||||
"AudioNode"sv,
|
||||
"AudioParam"sv,
|
||||
"AudioScheduledSourceNode"sv,
|
||||
"AudioTrack"sv,
|
||||
"BaseAudioContext"sv,
|
||||
"Blob"sv,
|
||||
|
|
|
@ -661,6 +661,7 @@ set(SOURCES
|
|||
WebAudio/AudioContext.cpp
|
||||
WebAudio/AudioNode.cpp
|
||||
WebAudio/AudioParam.cpp
|
||||
WebAudio/AudioScheduledSourceNode.cpp
|
||||
WebAudio/BaseAudioContext.cpp
|
||||
WebAudio/OfflineAudioContext.cpp
|
||||
WebAudio/PeriodicWave.cpp
|
||||
|
|
|
@ -683,6 +683,7 @@ namespace Web::WebAudio {
|
|||
class AudioContext;
|
||||
class AudioNode;
|
||||
class AudioParam;
|
||||
class AudioScheduledSourceNode;
|
||||
class BaseAudioContext;
|
||||
class OfflineAudioContext;
|
||||
class PeriodicWave;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/AudioScheduledSourceNodePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/WebAudio/AudioScheduledSourceNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(AudioScheduledSourceNode);
|
||||
|
||||
AudioScheduledSourceNode::~AudioScheduledSourceNode() = default;
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended
|
||||
JS::GCPtr<WebIDL::CallbackType> AudioScheduledSourceNode::onended()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::ended);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended
|
||||
void AudioScheduledSourceNode::set_onended(JS::GCPtr<WebIDL::CallbackType> value)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::ended, value);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-start
|
||||
WebIDL::ExceptionOr<void> AudioScheduledSourceNode::start(double when)
|
||||
{
|
||||
(void)when;
|
||||
return WebIDL::NotSupportedError::create(realm(), "FIXME: Implement AudioScheduledSourceNode::start"_fly_string);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-stop
|
||||
WebIDL::ExceptionOr<void> AudioScheduledSourceNode::stop(double when)
|
||||
{
|
||||
(void)when;
|
||||
return WebIDL::NotSupportedError::create(realm(), "FIXME: Implement AudioScheduledSourceNode::stop"_fly_string);
|
||||
}
|
||||
|
||||
void AudioScheduledSourceNode::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioScheduledSourceNode);
|
||||
}
|
||||
|
||||
void AudioScheduledSourceNode::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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/#AudioScheduledSourceNode
|
||||
class AudioScheduledSourceNode : public AudioNode {
|
||||
WEB_PLATFORM_OBJECT(AudioScheduledSourceNode, AudioNode);
|
||||
JS_DECLARE_ALLOCATOR(AudioScheduledSourceNode);
|
||||
|
||||
public:
|
||||
virtual ~AudioScheduledSourceNode() override;
|
||||
|
||||
JS::GCPtr<WebIDL::CallbackType> onended();
|
||||
void set_onended(JS::GCPtr<WebIDL::CallbackType>);
|
||||
|
||||
WebIDL::ExceptionOr<void> start(double when = 0);
|
||||
WebIDL::ExceptionOr<void> stop(double when = 0);
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <WebAudio/AudioNode.idl>
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#AudioScheduledSourceNode
|
||||
[Exposed=Window]
|
||||
interface AudioScheduledSourceNode : AudioNode {
|
||||
attribute EventHandler onended;
|
||||
undefined start(optional double when = 0);
|
||||
undefined stop(optional double when = 0);
|
||||
};
|
|
@ -297,6 +297,7 @@ libweb_js_bindings(WebAudio/AudioBuffer)
|
|||
libweb_js_bindings(WebAudio/AudioContext)
|
||||
libweb_js_bindings(WebAudio/AudioNode)
|
||||
libweb_js_bindings(WebAudio/AudioParam)
|
||||
libweb_js_bindings(WebAudio/AudioScheduledSourceNode)
|
||||
libweb_js_bindings(WebAudio/BaseAudioContext)
|
||||
libweb_js_bindings(WebAudio/OfflineAudioContext)
|
||||
libweb_js_bindings(WebAudio/PeriodicWave)
|
||||
|
|
Loading…
Add table
Reference in a new issue