/* * Copyright (c) 2024, Bar Yemini * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include namespace Web::WebAudio { JS_DEFINE_ALLOCATOR(AudioBufferSourceNode); AudioBufferSourceNode::AudioBufferSourceNode(JS::Realm& realm, JS::NonnullGCPtr context, AudioBufferSourceOptions const&) : AudioScheduledSourceNode(realm, context) { } AudioBufferSourceNode::~AudioBufferSourceNode() = default; WebIDL::ExceptionOr> AudioBufferSourceNode::create(JS::Realm& realm, JS::NonnullGCPtr context, AudioBufferSourceOptions const& options) { return construct_impl(realm, context, options); } // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-audiobuffersourcenode WebIDL::ExceptionOr> AudioBufferSourceNode::construct_impl(JS::Realm& realm, JS::NonnullGCPtr context, AudioBufferSourceOptions const& options) { // When the constructor is called with a BaseAudioContext c and an option object option, the user agent // MUST initialize the AudioNode this, with context and options as arguments. auto node = realm.vm().heap().allocate(realm, realm, context, options); return node; } void AudioBufferSourceNode::initialize(JS::Realm& realm) { Base::initialize(realm); WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioBufferSourceNode); } void AudioBufferSourceNode::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); } }