LibWeb/WebAudio: Manage channelCountMode and channelCount for PannerNode

This commit is contained in:
Pavel Shliak 2024-12-17 01:10:55 +04:00 committed by Alexander Kalenik
commit 884599f1df
Notes: github-actions[bot] 2024-12-18 09:21:00 +00:00
7 changed files with 2555 additions and 0 deletions

View file

@ -163,4 +163,24 @@ WebIDL::ExceptionOr<void> PannerNode::set_orientation(float x, float y, float z)
return {};
}
// https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode
WebIDL::ExceptionOr<void> PannerNode::set_channel_count_mode(Bindings::ChannelCountMode mode)
{
if (mode == Bindings::ChannelCountMode::Max) {
return WebIDL::NotSupportedError::create(realm(), "PannerNode does not support 'max' as channelCountMode."_string);
}
return AudioNode::set_channel_count_mode(mode);
}
// https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount
WebIDL::ExceptionOr<void> PannerNode::set_channel_count(WebIDL::UnsignedLong channel_count)
{
if (channel_count > 2) {
return WebIDL::NotSupportedError::create(realm(), "PannerNode does not support channel count greater than 2"_string);
}
return AudioNode::set_channel_count(channel_count);
}
}

View file

@ -77,6 +77,10 @@ public:
WebIDL::ExceptionOr<void> set_position(float x, float y, float z);
WebIDL::ExceptionOr<void> set_orientation(float x, float y, float z);
// ^AudioNode
virtual WebIDL::ExceptionOr<void> set_channel_count(WebIDL::UnsignedLong) override;
virtual WebIDL::ExceptionOr<void> set_channel_count_mode(Bindings::ChannelCountMode) override;
protected:
PannerNode(JS::Realm&, GC::Ref<BaseAudioContext>, PannerOptions const& = {});