| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | /*
 | 
					
						
							|  |  |  |  |  * Copyright (c) 2024, Shannon Booth <shannon@serenityos.org> | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |  * Copyright (c) 2025, Ben Eidson <b.e.eidson@gmail.com> | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  |  * | 
					
						
							|  |  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #include <LibWeb/Bindings/Intrinsics.h>
 | 
					
						
							|  |  |  |  | #include <LibWeb/WebAudio/AudioNode.h>
 | 
					
						
							| 
									
										
										
										
											2024-04-29 20:03:15 +12:00
										 |  |  |  | #include <LibWeb/WebAudio/BaseAudioContext.h>
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace Web::WebAudio { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |  | GC_DEFINE_ALLOCATOR(AudioNode); | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-07 23:24:10 +00:00
										 |  |  |  | AudioNode::AudioNode(JS::Realm& realm, GC::Ref<BaseAudioContext> context, WebIDL::UnsignedLong channel_count) | 
					
						
							| 
									
										
										
										
											2024-04-29 20:03:15 +12:00
										 |  |  |  |     : DOM::EventTarget(realm) | 
					
						
							|  |  |  |  |     , m_context(context) | 
					
						
							| 
									
										
										
										
											2025-01-07 23:24:10 +00:00
										 |  |  |  |     , m_channel_count(channel_count) | 
					
						
							| 
									
										
										
										
											2024-04-29 20:03:15 +12:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | AudioNode::~AudioNode() = default; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-20 03:28:48 +04:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::initialize_audio_node_options(AudioNodeOptions const& given_options, AudioNodeDefaultOptions const& default_options) | 
					
						
							| 
									
										
										
										
											2024-10-20 02:49:55 +04:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     // 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())); | 
					
						
							| 
									
										
										
										
											2024-10-20 03:28:48 +04:00
										 |  |  |  |     } else { | 
					
						
							|  |  |  |  |         TRY(set_channel_count(default_options.channel_count)); | 
					
						
							| 
									
										
										
										
											2024-10-20 02:49:55 +04:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 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())); | 
					
						
							| 
									
										
										
										
											2024-10-20 03:28:48 +04:00
										 |  |  |  |     } else { | 
					
						
							|  |  |  |  |         TRY(set_channel_count_mode(default_options.channel_count_mode)); | 
					
						
							| 
									
										
										
										
											2024-10-20 02:49:55 +04:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // Set channel interpretation, fallback to default if not provided
 | 
					
						
							| 
									
										
										
										
											2024-10-20 03:28:48 +04:00
										 |  |  |  |     if (given_options.channel_interpretation.has_value()) { | 
					
						
							|  |  |  |  |         TRY(set_channel_interpretation(given_options.channel_interpretation.value())); | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |         TRY(set_channel_interpretation(default_options.channel_interpretation)); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-10-20 02:49:55 +04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     return {}; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-connect
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |  | WebIDL::ExceptionOr<GC::Ref<AudioNode>> AudioNode::connect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     AudioNodeConnection output_connection { destination_node, output, input }; | 
					
						
							|  |  |  |  |     AudioNodeConnection input_connection { *this, output, input }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  |     // There can only be one connection between a given output of one specific node and a given input of another specific node.
 | 
					
						
							|  |  |  |  |     // Multiple connections with the same termini are ignored.
 | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     for (auto const& existing_connection : m_output_connections) { | 
					
						
							|  |  |  |  |         if (existing_connection == output_connection) | 
					
						
							|  |  |  |  |             return destination_node; | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     // If the destination parameter is an AudioNode that has been created using another AudioContext, an InvalidAccessError MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (m_context != destination_node->m_context) { | 
					
						
							| 
									
										
										
										
											2024-10-12 20:56:21 +02:00
										 |  |  |  |         return WebIDL::InvalidAccessError::create(realm(), "Cannot connect to an AudioNode in a different AudioContext"_string); | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-04 02:21:16 +00:00
										 |  |  |  |     // The output parameter is an index describing which output of the AudioNode from which to connect.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // The input parameter is an index describing which input of the destination AudioNode to connect to.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (input >= destination_node->number_of_inputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Input index '{}' exceeds number of inputs", input))); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     // Connect node's output to destination_node input.
 | 
					
						
							|  |  |  |  |     m_output_connections.append(output_connection); | 
					
						
							|  |  |  |  |     // Connect destination_node input to node's output.
 | 
					
						
							|  |  |  |  |     destination_node->m_input_connections.append(input_connection); | 
					
						
							| 
									
										
										
										
											2025-01-04 02:21:16 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-24 17:35:52 +12:00
										 |  |  |  |     return destination_node; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
 | 
					
						
							| 
									
										
										
										
											2025-01-04 02:21:16 +00:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::connect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     AudioParamConnection param_connection { destination_param, output }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // There can only be one connection between a given output of one specific node and a specific AudioParam. Multiple connections
 | 
					
						
							|  |  |  |  |     //  with the same termini are ignored.
 | 
					
						
							|  |  |  |  |     for (auto const& existing_connection : m_param_connections) { | 
					
						
							|  |  |  |  |         if (existing_connection == param_connection) | 
					
						
							|  |  |  |  |             return {}; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 20:04:28 +00:00
										 |  |  |  |     // If destinationParam belongs to an AudioNode that belongs to a BaseAudioContext that is different from the BaseAudioContext
 | 
					
						
							|  |  |  |  |     // that has created the AudioNode on which this method was called, an InvalidAccessError MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (m_context != destination_param->context()) { | 
					
						
							|  |  |  |  |         return WebIDL::InvalidAccessError::create(realm(), "Cannot connect to an AudioParam in a different AudioContext"_string); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-04 02:21:16 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     // The output parameter is an index describing which output of the AudioNode from which to connect.
 | 
					
						
							|  |  |  |  |     // If the parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     // Connect node's output to destination_param.
 | 
					
						
							|  |  |  |  |     m_param_connections.append(param_connection); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-04 02:21:16 +00:00
										 |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
 | 
					
						
							|  |  |  |  | void AudioNode::disconnect() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect()"); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output
 | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::disconnect(WebIDL::UnsignedLong output) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     // The output parameter is an index describing which output of the AudioNode to disconnect.
 | 
					
						
							|  |  |  |  |     // It disconnects all outgoing connections from the given output.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(output)"); | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |  | void AudioNode::disconnect(GC::Ref<AudioNode> destination_node) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     (void)destination_node; | 
					
						
							|  |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(destination_node)"); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output
 | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     (void)destination_node; | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     // The output parameter is an index describing which output of the AudioNode from which to disconnect.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(destination_node, output)"); | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input
 | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::disconnect(GC::Ref<AudioNode> destination_node, WebIDL::UnsignedLong output, WebIDL::UnsignedLong input) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     (void)destination_node; | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     // The output parameter is an index describing which output of the AudioNode from which to disconnect.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // The input parameter is an index describing which input of the destination AudioNode to disconnect.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (input >= destination_node->number_of_inputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Input index '{}' exceeds number of inputs", input))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(destination_node, output, input)"); | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |  | void AudioNode::disconnect(GC::Ref<AudioParam> destination_param) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     (void)destination_param; | 
					
						
							|  |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(destination_param)"); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam-output
 | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  | WebIDL::ExceptionOr<void> AudioNode::disconnect(GC::Ref<AudioParam> destination_param, WebIDL::UnsignedLong output) | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     (void)destination_param; | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     // The output parameter is an index describing which output of the AudioNode from which to disconnect.
 | 
					
						
							|  |  |  |  |     // If this parameter is out-of-bounds, an IndexSizeError exception MUST be thrown.
 | 
					
						
							|  |  |  |  |     if (output >= number_of_outputs()) { | 
					
						
							|  |  |  |  |         return WebIDL::IndexSizeError::create(realm(), MUST(String::formatted("Output index {} exceeds number of outputs", output))); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  |     dbgln("FIXME: Implement AudioNode::disconnect(destination_param, output)"); | 
					
						
							| 
									
										
										
										
											2025-01-08 23:09:17 +00:00
										 |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount
 | 
					
						
							|  |  |  |  | WebIDL::ExceptionOr<void> AudioNode::set_channel_count(WebIDL::UnsignedLong channel_count) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2024-10-08 13:51:27 +02:00
										 |  |  |  |     // If this value is set to zero or to a value greater than the implementation’s maximum number
 | 
					
						
							|  |  |  |  |     // of channels the implementation MUST throw a NotSupportedError exception.
 | 
					
						
							|  |  |  |  |     if (channel_count == 0 || channel_count > BaseAudioContext::MAX_NUMBER_OF_CHANNELS) | 
					
						
							| 
									
										
										
										
											2024-10-12 20:56:21 +02:00
										 |  |  |  |         return WebIDL::NotSupportedError::create(realm(), "Invalid channel count"_string); | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-08 13:51:27 +02:00
										 |  |  |  |     m_channel_count = channel_count; | 
					
						
							|  |  |  |  |     return {}; | 
					
						
							| 
									
										
										
										
											2024-07-27 12:36:14 +03:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode
 | 
					
						
							|  |  |  |  | WebIDL::ExceptionOr<void> AudioNode::set_channel_count_mode(Bindings::ChannelCountMode channel_count_mode) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     m_channel_count_mode = channel_count_mode; | 
					
						
							|  |  |  |  |     return {}; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcountmode
 | 
					
						
							|  |  |  |  | Bindings::ChannelCountMode AudioNode::channel_count_mode() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return m_channel_count_mode; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-channelinterpretation
 | 
					
						
							|  |  |  |  | WebIDL::ExceptionOr<void> AudioNode::set_channel_interpretation(Bindings::ChannelInterpretation channel_interpretation) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     m_channel_interpretation = channel_interpretation; | 
					
						
							|  |  |  |  |     return {}; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // https://webaudio.github.io/web-audio-api/#dom-audionode-channelinterpretation
 | 
					
						
							|  |  |  |  | Bindings::ChannelInterpretation AudioNode::channel_interpretation() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return m_channel_interpretation; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | void AudioNode::initialize(JS::Realm& realm) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioNode); | 
					
						
							| 
									
										
										
										
											2025-04-20 16:22:57 +02:00
										 |  |  |  |     Base::initialize(realm); | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void AudioNode::visit_edges(Cell::Visitor& visitor) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     Base::visit_edges(visitor); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:03:15 +12:00
										 |  |  |  |     visitor.visit(m_context); | 
					
						
							| 
									
										
										
										
											2025-05-20 21:15:15 -04:00
										 |  |  |  |     for (auto& conn : m_param_connections) | 
					
						
							|  |  |  |  |         visitor.visit(conn.destination_param); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     for (auto& conn : m_input_connections) | 
					
						
							|  |  |  |  |         visitor.visit(conn.destination_node); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     for (auto& conn : m_output_connections) | 
					
						
							|  |  |  |  |         visitor.visit(conn.destination_node); | 
					
						
							| 
									
										
										
										
											2024-04-28 12:46:07 +12:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } |