mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
This commit is contained in:
parent
ed658154d2
commit
f2ed59879f
Notes:
github-actions[bot]
2024-10-29 13:32:57 +00:00
Author: https://github.com/shlyakpavel
Commit: f2ed59879f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1735
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
6 changed files with 100 additions and 5 deletions
|
@ -21,6 +21,32 @@ AudioNode::AudioNode(JS::Realm& realm, JS::NonnullGCPtr<BaseAudioContext> contex
|
|||
|
||||
AudioNode::~AudioNode() = default;
|
||||
|
||||
WebIDL::ExceptionOr<void> AudioNode::initialize_audio_node_options(JS::NonnullGCPtr<BaseAudioContext> context, AudioNodeOptions const& given_options, AudioNodeOptions const& default_options)
|
||||
{
|
||||
// FIXME: Context will be used in the future implementation.
|
||||
(void)context; // Cast to void to avoid unused parameter warning.
|
||||
|
||||
// Set channel count, fallback to default if not provided
|
||||
if (given_options.channel_count.has_value()) {
|
||||
TRY(set_channel_count(given_options.channel_count.value()));
|
||||
} else if (default_options.channel_count.has_value()) {
|
||||
TRY(set_channel_count(default_options.channel_count.value()));
|
||||
}
|
||||
|
||||
// Set channel count mode, fallback to default if not provided
|
||||
if (given_options.channel_count_mode.has_value()) {
|
||||
TRY(set_channel_count_mode(given_options.channel_count_mode.value()));
|
||||
} else if (default_options.channel_count_mode.has_value()) {
|
||||
TRY(set_channel_count_mode(default_options.channel_count_mode.value()));
|
||||
}
|
||||
|
||||
// Set channel interpretation, fallback to default if not provided
|
||||
Bindings::ChannelInterpretation channel_interpretation_to_set = given_options.channel_interpretation.value_or(default_options.channel_interpretation.value_or(Bindings::ChannelInterpretation::Speakers));
|
||||
TRY(set_channel_interpretation(channel_interpretation_to_set));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AudioNode>> AudioNode::connect(JS::NonnullGCPtr<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue