LibWeb/WebAudio: Add BaseAudioContext.createDelay() factory method

This commit is contained in:
Tim Ledbetter 2025-01-04 00:39:02 +00:00 committed by Tim Ledbetter
parent 6c4c925f02
commit 911cd4aefd
Notes: github-actions[bot] 2025-01-08 15:33:01 +00:00
3 changed files with 12 additions and 1 deletions

View file

@ -96,6 +96,15 @@ WebIDL::ExceptionOr<GC::Ref<ConstantSourceNode>> BaseAudioContext::create_consta
return ConstantSourceNode::create(realm(), *this);
}
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createdelay
WebIDL::ExceptionOr<GC::Ref<DelayNode>> BaseAudioContext::create_delay(double max_delay_time)
{
DelayOptions options;
options.max_delay_time = max_delay_time;
return DelayNode::create(realm(), *this, options);
}
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelsplitter
WebIDL::ExceptionOr<GC::Ref<ChannelSplitterNode>> BaseAudioContext::create_channel_splitter(WebIDL::UnsignedLong number_of_outputs)
{

View file

@ -15,6 +15,7 @@
#include <LibWeb/WebAudio/ChannelMergerNode.h>
#include <LibWeb/WebAudio/ChannelSplitterNode.h>
#include <LibWeb/WebAudio/ConstantSourceNode.h>
#include <LibWeb/WebAudio/DelayNode.h>
#include <LibWeb/WebAudio/PeriodicWave.h>
#include <LibWeb/WebIDL/Types.h>
@ -64,6 +65,7 @@ public:
WebIDL::ExceptionOr<GC::Ref<ChannelMergerNode>> create_channel_merger(WebIDL::UnsignedLong number_of_inputs);
WebIDL::ExceptionOr<GC::Ref<ConstantSourceNode>> create_constant_source();
WebIDL::ExceptionOr<GC::Ref<ChannelSplitterNode>> create_channel_splitter(WebIDL::UnsignedLong number_of_outputs);
WebIDL::ExceptionOr<GC::Ref<DelayNode>> create_delay(double max_delay_time = 1);
WebIDL::ExceptionOr<GC::Ref<OscillatorNode>> create_oscillator();
WebIDL::ExceptionOr<GC::Ref<DynamicsCompressorNode>> create_dynamics_compressor();
WebIDL::ExceptionOr<GC::Ref<GainNode>> create_gain();

View file

@ -38,7 +38,7 @@ interface BaseAudioContext : EventTarget {
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6);
ConstantSourceNode createConstantSource ();
[FIXME] ConvolverNode createConvolver ();
[FIXME] DelayNode createDelay (optional double maxDelayTime = 1.0);
DelayNode createDelay (optional double maxDelayTime = 1.0);
DynamicsCompressorNode createDynamicsCompressor();
GainNode createGain();
[FIXME] IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);