mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 20:29:03 +00:00
LibWeb: Add stub IDL interface for AudioParam
An AudioParam is a fundamental building block in WebAudio as it controls the value of an individual parameter of an AudioNode, such as volume.
This commit is contained in:
parent
b1b7e2324a
commit
5ae0ac7b73
Notes:
sideshowbarker
2024-07-17 02:28:18 +09:00
Author: https://github.com/shannonbooth
Commit: 5ae0ac7b73
Pull-request: https://github.com/SerenityOS/serenity/pull/24143
7 changed files with 213 additions and 0 deletions
56
Userland/Libraries/LibWeb/WebAudio/AudioParam.h
Normal file
56
Userland/Libraries/LibWeb/WebAudio/AudioParam.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/AudioParamPrototype.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#AudioParam
|
||||
class AudioParam final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(AudioParam, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(AudioParam);
|
||||
|
||||
public:
|
||||
virtual ~AudioParam() override;
|
||||
|
||||
float value() const;
|
||||
void set_value(float);
|
||||
|
||||
Bindings::AutomationRate automation_rate() const;
|
||||
WebIDL::ExceptionOr<void> set_automation_rate(Bindings::AutomationRate);
|
||||
|
||||
float default_value() const;
|
||||
float min_value() const;
|
||||
float max_value() const;
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> set_value_at_time(float value, double start_time);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> linear_ramp_to_value_at_time(float value, double end_time);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> exponential_ramp_to_value_at_time(float value, double end_time);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> set_target_at_time(float target, double start_time, float time_constant);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> set_value_curve_at_time(Span<float> values, double start_time, double duration);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> cancel_scheduled_values(double cancel_time);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioParam>> cancel_and_hold_at_time(double cancel_time);
|
||||
|
||||
private:
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audioparam-current-value-slot
|
||||
float m_current_value {}; // [[current value]]
|
||||
|
||||
float m_default_value {};
|
||||
|
||||
float m_min_value {};
|
||||
float m_max_value {};
|
||||
|
||||
Bindings::AutomationRate m_automation_rate {};
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue