mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 13:18:19 +00:00
LibWeb: Initialize AudioBufferSourceNode
with correct defaults
This commit is contained in:
parent
9370990ff2
commit
a6ab9cc983
Notes:
github-actions[bot]
2025-01-08 14:46:56 +00:00
Author: https://github.com/tcl3
Commit: a6ab9cc983
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3128
4 changed files with 178 additions and 2 deletions
|
@ -129,6 +129,17 @@ WebIDL::ExceptionOr<GC::Ref<AudioBufferSourceNode>> AudioBufferSourceNode::const
|
|||
// MUST initialize the AudioNode this, with context and options as arguments.
|
||||
|
||||
auto node = realm.create<AudioBufferSourceNode>(realm, context, options);
|
||||
|
||||
// Default options for channel count and interpretation
|
||||
// https://webaudio.github.io/web-audio-api/#AudioBufferSourceNode
|
||||
AudioNodeDefaultOptions default_options;
|
||||
default_options.channel_count = 2;
|
||||
default_options.channel_count_mode = Bindings::ChannelCountMode::Max;
|
||||
default_options.channel_interpretation = Bindings::ChannelInterpretation::Speakers;
|
||||
// FIXME: Set tail-time to no
|
||||
|
||||
TRY(node->initialize_audio_node_options(options, default_options));
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace Web::WebAudio {
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#AudioBufferSourceOptions
|
||||
struct AudioBufferSourceOptions {
|
||||
struct AudioBufferSourceOptions : AudioNodeOptions {
|
||||
GC::Ptr<AudioBuffer> buffer;
|
||||
float detune { 0 };
|
||||
bool loop { false };
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
WebIDL::ExceptionOr<void> set_loop_end(double);
|
||||
double loop_end() const;
|
||||
WebIDL::UnsignedLong number_of_inputs() override { return 0; }
|
||||
WebIDL::UnsignedLong number_of_outputs() override { return 2; }
|
||||
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
|
||||
|
||||
WebIDL::ExceptionOr<void> start(Optional<double>, Optional<double>, Optional<double>);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue