mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb/WebAudio: Implement AudioNode::connect()
Sets up the basic infrastructure for the audio node graph and implements the AudioNode `connect()` method with its related overides. AudioNodes store vectors of AudioNodeConnections and AudioParamConnections to represent links between nodes.
This commit is contained in:
parent
cee874caaf
commit
15aa7dce29
Notes:
github-actions[bot]
2025-06-17 22:57:18 +00:00
Author: https://github.com/Prospero23
Commit: 15aa7dce29
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4831
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 54 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2025, Ben Eidson <b.e.eidson@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -28,6 +29,21 @@ struct AudioNodeDefaultOptions {
|
|||
Bindings::ChannelInterpretation channel_interpretation;
|
||||
};
|
||||
|
||||
struct AudioNodeConnection {
|
||||
GC::Ref<AudioNode> destination_node;
|
||||
WebIDL::UnsignedLong output;
|
||||
WebIDL::UnsignedLong input;
|
||||
|
||||
bool operator==(AudioNodeConnection const& other) const = default;
|
||||
};
|
||||
|
||||
struct AudioParamConnection {
|
||||
GC::Ref<AudioParam> destination_param;
|
||||
WebIDL::UnsignedLong output;
|
||||
|
||||
bool operator==(AudioParamConnection const& other) const = default;
|
||||
};
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#AudioNode
|
||||
class AudioNode : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(AudioNode, DOM::EventTarget);
|
||||
|
@ -81,6 +97,12 @@ private:
|
|||
WebIDL::UnsignedLong m_channel_count { 2 };
|
||||
Bindings::ChannelCountMode m_channel_count_mode { Bindings::ChannelCountMode::Max };
|
||||
Bindings::ChannelInterpretation m_channel_interpretation { Bindings::ChannelInterpretation::Speakers };
|
||||
// Connections from other AudioNode outputs into this node's inputs.
|
||||
Vector<AudioNodeConnection> m_input_connections;
|
||||
// Connections from this node's outputs into other AudioNode inputs.
|
||||
Vector<AudioNodeConnection> m_output_connections;
|
||||
// Connections from this node's outputs into AudioParams.
|
||||
Vector<AudioParamConnection> m_param_connections;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue