/* * Copyright (c) 2024, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::WebAudio { // https://webaudio.github.io/web-audio-api/#GainOptions struct GainOptions : AudioNodeOptions { float gain { 1.0 }; }; // https://webaudio.github.io/web-audio-api/#GainNode class GainNode : public AudioNode { WEB_PLATFORM_OBJECT(GainNode, AudioNode); JS_DECLARE_ALLOCATOR(GainNode); public: virtual ~GainNode() override; static JS::NonnullGCPtr create(JS::Realm&, JS::NonnullGCPtr, GainOptions const& = {}); static JS::NonnullGCPtr construct_impl(JS::Realm&, JS::NonnullGCPtr, GainOptions const& = {}); JS::NonnullGCPtr gain() const { return m_gain; } protected: GainNode(JS::Realm&, JS::NonnullGCPtr, GainOptions const& = {}); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: // https://webaudio.github.io/web-audio-api/#dom-gainnode-gain JS::NonnullGCPtr m_gain; }; }