mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Implement OscillatorNode.type
This is a simple getter and setter of the OscillatorType enum, with error checking to not allow 'custom', as that should only be changed through 'setPeriodicWave()'.
This commit is contained in:
parent
b48ba823b9
commit
099c9e4a7e
Notes:
sideshowbarker
2024-07-16 20:08:14 +09:00
Author: https://github.com/shannonbooth
Commit: 099c9e4a7e
Pull-request: https://github.com/SerenityOS/serenity/pull/24195
5 changed files with 61 additions and 2 deletions
|
@ -30,11 +30,20 @@ public:
|
|||
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& = {});
|
||||
|
||||
Bindings::OscillatorType type() const;
|
||||
WebIDL::ExceptionOr<void> set_type(Bindings::OscillatorType);
|
||||
|
||||
protected:
|
||||
OscillatorNode(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, OscillatorOptions const& = {});
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
static WebIDL::ExceptionOr<void> verify_valid_type(JS::Realm&, Bindings::OscillatorType);
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-oscillatornode-type
|
||||
Bindings::OscillatorType m_type { Bindings::OscillatorType::Sine };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue