mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
LibWeb: Add stub IDL interface for OscillatorNode
This source node generates a periodic wave form.
This commit is contained in:
parent
c9b2c1c747
commit
a83f4216a5
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/shannonbooth
Commit: a83f4216a5
Pull-request: https://github.com/SerenityOS/serenity/pull/24143
6 changed files with 109 additions and 0 deletions
38
Userland/Libraries/LibWeb/WebAudio/OscillatorNode.h
Normal file
38
Userland/Libraries/LibWeb/WebAudio/OscillatorNode.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/OscillatorNodePrototype.h>
|
||||
#include <LibWeb/WebAudio/AudioScheduledSourceNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#OscillatorOptions
|
||||
struct OscillatorOptions : AudioNodeOptions {
|
||||
Bindings::OscillatorType type { Bindings::OscillatorType::Sine };
|
||||
float frequency { 440 };
|
||||
float detune { 0 };
|
||||
JS::GCPtr<PeriodicWave> periodic_wave;
|
||||
};
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#OscillatorNode
|
||||
class OscillatorNode : public AudioScheduledSourceNode {
|
||||
WEB_PLATFORM_OBJECT(OscillatorNode, AudioScheduledSourceNode);
|
||||
JS_DECLARE_ALLOCATOR(OscillatorNode);
|
||||
|
||||
public:
|
||||
virtual ~OscillatorNode() override;
|
||||
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, OscillatorOptions const& = {});
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, OscillatorOptions const& = {});
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue