35[[nodiscard]] std::unordered_map<std::string, std::string>
41 {
"enabled",
m_enabled ?
"true" :
"false" } };
45 const std::shared_ptr<Node>& source,
52 const std::shared_ptr<NodeNetwork>& source_network)
61 [&](
const auto& m) {
return m.param_name == param_name; });
71 if (channel_id < 32) {
78 if (channel_id < 32) {
85 if (channel_id < 32) {
93 std::vector<uint32_t> channels;
94 for (uint32_t i = 0; i < 32; ++i) {
96 channels.push_back(i);
119 if (channel_id >= 32)
122 auto channel_bit =
static_cast<uint32_t
>(1ULL << channel_id);
124 std::memory_order_acq_rel);
125 uint32_t new_pending = old_pending | channel_bit;
126 uint32_t active_channels =
m_channel_mask.load(std::memory_order_acquire);
128 if ((new_pending & active_channels) == active_channels && active_channels != 0) {
129 uint32_t expected = new_pending;
131 std::memory_order_acq_rel)) {
std::vector< ParameterMapping > m_parameter_mappings
virtual void unmap_parameter(const std::string ¶m_name)
Remove parameter mapping.
std::atomic< bool > m_processed_this_cycle
bool is_processed_this_cycle() const
Check if network has been processed this cycle (lock-free)
std::atomic< bool > m_processing_state
Per-channel processing state (lock-free atomic flags)
virtual void map_parameter(const std::string ¶m_name, const std::shared_ptr< Node > &source, MappingMode mode=MappingMode::BROADCAST)
Map external node output to network parameter.
void apply_output_scale()
Apply m_output_scale to m_last_audio_buffer.
std::vector< uint32_t > get_registered_channels() const
Get all channels this network is registered on.
virtual void initialize()
Called once before first process_batch()
void mark_processing(bool processing)
Mark network as processing or not (lock-free)
virtual std::optional< std::vector< double > > get_audio_buffer() const
Get cached audio buffer from last process_batch()
static std::string topology_to_string(Topology topo)
void add_channel_usage(uint32_t channel_id)
Register network usage on a specific channel.
void remove_channel_usage(uint32_t channel_id)
Unregister network from a specific channel.
void mark_processed(bool processed)
Mark network as processed this cycle (lock-free)
double m_output_scale
Post-processing scalar applied to m_last_audio_buffer each batch.
bool is_registered_on_channel(uint32_t channel_id) const
Check if network is registered on a channel.
bool is_processing() const
Check if network is currently processing (lock-free)
std::atomic< uint32_t > m_channel_mask
Bitfield of channels this network is registered on.
void ensure_initialized()
Ensure initialize() is called exactly once.
void request_reset_from_channel(uint32_t channel_id)
Request a reset from a specific channel.
static std::string output_mode_to_string(OutputMode mode)
virtual std::unordered_map< std::string, std::string > get_metadata() const
Get network metadata for debugging/visualization.
std::vector< double > m_last_audio_buffer
std::atomic< uint32_t > m_pending_reset_mask
virtual size_t get_node_count() const =0
Get the number of nodes in the network.
Topology
Defines the structural relationships between nodes in the network.
MappingMode
Defines how nodes map to external entities (e.g., audio channels, graphics objects)
@ ONE_TO_ONE
Node array/network → network nodes (must match count)
OutputMode
Defines how the network's computational results are exposed.
@ AUDIO_COMPUTE
processed each cycle but not sent to output
@ AUDIO_SINK
Aggregated audio samples sent to output.
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)