Skip to content

Commit 2c3fdec

Browse files
tcl3pbrw
authored andcommitted
LibWeb: Initialize OcillatorNode with the correct default options
1 parent 9e3c375 commit 2c3fdec

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Libraries/LibWeb/WebAudio/OscillatorNode.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,19 @@ WebIDL::ExceptionOr<GC::Ref<OscillatorNode>> OscillatorNode::create(JS::Realm& r
2424
// https://webaudio.github.io/web-audio-api/#dom-oscillatornode-oscillatornode
2525
WebIDL::ExceptionOr<GC::Ref<OscillatorNode>> OscillatorNode::construct_impl(JS::Realm& realm, GC::Ref<BaseAudioContext> context, OscillatorOptions const& options)
2626
{
27-
// FIXME: Invoke "Initialize the AudioNode" steps.
2827
TRY(verify_valid_type(realm, options.type));
2928
auto node = realm.create<OscillatorNode>(realm, context, options);
29+
30+
// Default options for channel count and interpretation
31+
// https://webaudio.github.io/web-audio-api/#OscillatorNode
32+
AudioNodeDefaultOptions default_options;
33+
default_options.channel_count = 2;
34+
default_options.channel_count_mode = Bindings::ChannelCountMode::Max;
35+
default_options.channel_interpretation = Bindings::ChannelInterpretation::Speakers;
36+
// FIXME: Set tail-time to no
37+
38+
TRY(node->initialize_audio_node_options(options, default_options));
39+
3040
return node;
3141
}
3242

0 commit comments

Comments
 (0)