mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
LibWeb/WebAudio: Manage channelCountMode and channelCount for PannerNode
This commit is contained in:
parent
15a96e841b
commit
884599f1df
Notes:
github-actions[bot]
2024-12-18 09:21:00 +00:00
Author: https://github.com/shlyakpavel
Commit: 884599f1df
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2944
Reviewed-by: https://github.com/gmta
7 changed files with 2555 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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& = {});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue