21[[nodiscard]] std::unordered_map<std::string, std::string>
27 {
"enabled",
m_enabled ?
"true" :
"false" } };
31 const std::shared_ptr<Node>& source,
39 const std::shared_ptr<NodeNetwork>& source_network)
50 [&](
const auto& m) { return m.param_name == param_name; }),
61 if (channel_id < 32) {
68 if (channel_id < 32) {
75 if (channel_id < 32) {
83 std::vector<uint32_t> channels;
84 for (uint32_t i = 0; i < 32; ++i) {
86 channels.push_back(i);
111 return "INDEPENDENT";
137 return "GRAPHICS_BIND";
virtual std::optional< std::vector< double > > get_audio_buffer() const
Get cached audio buffer from last process_batch()
std::vector< ParameterMapping > m_parameter_mappings
std::atomic< uint32_t > m_channel_mask
Bitfield of channels this network is registered on.
static std::string output_mode_to_string(OutputMode mode)
void ensure_initialized()
Ensure initialize() is called exactly once.
bool is_processed_this_cycle() const
Check if network has been processed this cycle (lock-free)
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)
bool is_processing() const
Check if network is currently processing (lock-free)
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.
std::vector< uint32_t > get_registered_channels() const
Get all channels this network is registered on.
Topology
Defines the structural relationships between nodes in the network.
@ CHAIN
Linear sequence: node[i] → node[i+1].
@ GRID_2D
2D lattice with 4-connectivity
@ INDEPENDENT
No connections, nodes process independently.
@ CUSTOM
User-defined arbitrary topology.
@ GRID_3D
3D lattice with 6-connectivity
@ SPATIAL
Dynamic proximity-based (nodes within radius interact)
@ RING
Circular: last node connects to first.
std::vector< double > m_last_audio_buffer
bool is_registered_on_channel(uint32_t channel_id) const
Check if network is registered on a channel.
virtual std::unordered_map< std::string, std::string > get_metadata() const
Get network metadata for debugging/visualization.
OutputMode
Defines how the network's computational results are exposed.
@ CUSTOM
User-defined output handling via callbacks.
@ GRAPHICS_BIND
State available for visualization (read-only)
@ NONE
Pure internal state, no external output.
@ AUDIO_SINK
Aggregated audio samples sent to output.
std::atomic< bool > m_processing_state
Per-channel processing state (lock-free atomic flags)
void mark_processing(bool processing)
Mark network as processing or not (lock-free)
static std::string topology_to_string(Topology topo)
void remove_channel_usage(uint32_t channel_id)
Unregister network from a specific channel.
virtual size_t get_node_count() const =0
Get the number of nodes in the network.
void add_channel_usage(uint32_t channel_id)
Register network usage on a specific channel.
void mark_processed(bool processed)
Mark network as processed this cycle (lock-free)
virtual void unmap_parameter(const std::string ¶m_name)
Remove parameter mapping.
std::atomic< bool > m_processed_this_cycle
virtual void initialize()
Called once before first process_batch()
Contains the node-based computational processing system components.