|
MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
|
Connects an ordered sequence of nodes in series. More...
#include <NodeChain.hpp>
Inheritance diagram for MayaFlux::Nodes::ChainNode:
Collaboration diagram for MayaFlux::Nodes::ChainNode:Public Member Functions | |
| ChainNode (std::vector< std::shared_ptr< Node > > nodes) | |
| Creates a chain from an ordered sequence of nodes. | |
| ChainNode (std::vector< std::shared_ptr< Node > > nodes, NodeGraphManager &manager, ProcessingToken token=ProcessingToken::AUDIO_RATE) | |
| Creates a chain from an ordered sequence of nodes (managed) | |
| ChainNode (const std::shared_ptr< Node > &source, const std::shared_ptr< Node > &target) | |
| Creates a chain from two nodes (unmanaged) | |
| ChainNode (const std::shared_ptr< Node > &source, const std::shared_ptr< Node > &target, NodeGraphManager &manager, ProcessingToken token=ProcessingToken::AUDIO_RATE) | |
| Creates a chain from two nodes (managed) | |
| void | append (const std::shared_ptr< Node > &node) |
| Appends a node to the end of the chain. | |
| void | append_chain (const std::shared_ptr< ChainNode > &other) |
| Appends all nodes from another chain. | |
| size_t | size () const |
| Returns the number of nodes in the chain. | |
| const std::vector< std::shared_ptr< Node > > & | nodes () const |
| Returns a const reference to the internal node sequence. | |
| void | initialize () |
| Initializes the chain node. | |
| double | process_sample (double input=0.) override |
| Processes a single data sample. | |
| std::vector< double > | process_batch (unsigned int num_samples) override |
| Processes multiple samples at once. | |
| void | on_tick (const NodeHook &callback) override |
| Registers a callback to be called on each tick. | |
| void | on_tick_if (const NodeCondition &condition, const NodeHook &callback) override |
| Registers a conditional callback. | |
| void | remove_all_hooks () override |
| Removes all registered callbacks. | |
| void | reset_processed_state () override |
| Resets the processed state of the node and any attached input nodes. | |
| NodeContext & | get_last_context () override |
| Retrieves the last created context object. | |
| void | save_state () override |
| Saves the node's current state for later restoration Recursively cascades through all connected modulator nodes Protected - only NodeSourceProcessor and NodeBuffer can call. | |
| void | restore_state () override |
| Restores the node's state from the last save Recursively cascades through all connected modulator nodes Protected - only NodeSourceProcessor and NodeBuffer can call. | |
| bool | is_initialized () const |
Public Member Functions inherited from MayaFlux::Nodes::Node | |
| virtual | ~Node ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual bool | remove_hook (const NodeHook &callback) |
| Removes a previously registered callback. | |
| virtual bool | remove_conditional_hook (const NodeCondition &callback) |
| Removes a previously registered conditional callback. | |
| virtual double | get_last_output () |
| Retrieves the most recent output value produced by the node. | |
| void | register_channel_usage (uint32_t channel_id) |
| Mark the specificed channel as a processor/user. | |
| void | unregister_channel_usage (uint32_t channel_id) |
| Removes the specified channel from the usage tracking. | |
| bool | is_used_by_channel (uint32_t channel_id) const |
| Checks if the node is currently used by a specific channel. | |
| void | request_reset_from_channel (uint32_t channel_id) |
| Requests a reset of the processed state from a specific channel. | |
| const std::atomic< uint32_t > & | get_channel_mask () const |
| Retrieves the current bitmask of active channels using this node. | |
| virtual void | set_gpu_compatible (bool compatible) |
| Sets whether the node is compatible with GPU processing. | |
| bool | is_gpu_compatible () const |
| Checks if the node supports GPU processing. | |
| std::span< const float > | get_gpu_data_buffer () const |
| Provides access to the GPU data buffer. | |
| void | set_sample_rate (uint32_t sample_rate) |
| uint32_t | get_sample_rate () const |
| bool | try_claim_snapshot_context (uint64_t context_id) |
| Attempt to claim snapshot context for this processing cycle. | |
| bool | is_in_snapshot_context (uint64_t context_id) const |
| Check if currently in a snapshot context. | |
| void | release_snapshot_context (uint64_t context_id) |
| Release snapshot context. | |
| bool | has_active_snapshot () const |
| Check if node is currently being snapshotted by any context. | |
| uint64_t | get_active_snapshot_context () const |
| Get the active snapshot context ID. | |
| void | add_buffer_reference () |
| Increments the buffer reference count This method is called when a new buffer starts using this node to ensure proper lifecycle management. | |
| void | remove_buffer_reference () |
| Decrements the buffer reference count This method is called when a buffer stops using this node to ensure proper lifecycle management. | |
| bool | mark_buffer_processed () |
| Marks the node as having been processed by a buffer. | |
| void | request_buffer_reset () |
| Requests a reset of the buffer state. | |
| bool | is_buffer_processed () const |
| Checks if the buffer has been processed. | |
| bool | is_in_network () const |
| Sets whether the node is part of a NodeNetwork. | |
| void | set_in_network (bool networked) |
| Marks the node as being part of a NodeNetwork. | |
| const RoutingState & | get_routing_state () const |
| Retrieves the current routing state of the network. | |
| RoutingState & | get_routing_state () |
| Retrieves the current routing state of the network (non-const) | |
| bool | needs_channel_routing () const |
| Checks if the network is currently in a routing transition phase. | |
| virtual uint8_t | node_capabilities () const |
| Declare which data shapes this node's context can produce. | |
| bool | has_capability (NodeCapability cap) const |
| Query a single capability. | |
Protected Member Functions | |
| void | notify_tick (double) override |
| Notifies all registered callbacks with the current context. | |
| void | update_context (double) override |
| Updates the context object with the current node state. | |
Protected Member Functions inherited from MayaFlux::Nodes::Node | |
| virtual void | reset_processed_state_internal () |
| Resets the processed state of the node directly. | |
Private Attributes | |
| std::vector< std::shared_ptr< Node > > | m_nodes |
| NodeGraphManager * | m_manager {} |
| ProcessingToken | m_token { ProcessingToken::AUDIO_RATE } |
| bool | m_is_initialized {} |
| bool | m_state_saved {} |
Additional Inherited Members | |
Public Attributes inherited from MayaFlux::Nodes::Node | |
| bool | m_fire_events_during_snapshot = false |
| Internal flag controlling whether notify_tick fires during state snapshots Default: false (events don't fire during isolated buffer processing) Can be exposed in future if needed via concrete implementation in parent. | |
| std::atomic< NodeState > | m_state { NodeState::INACTIVE } |
| Atomic state flag tracking the node's processing status. | |
| std::atomic< uint32_t > | m_modulator_count { 0 } |
| Counter tracking how many other nodes are using this node as a modulator. | |
Protected Attributes inherited from MayaFlux::Nodes::Node | |
| double | m_last_output { 0 } |
| The most recent sample value generated by this oscillator. | |
| bool | m_gpu_compatible {} |
| Flag indicating if the node supports GPU processing This flag is set by derived classes to indicate whether the node can be processed on the GPU. | |
| std::vector< float > | m_gpu_data_buffer |
| GPU data buffer for context objects. | |
| std::vector< NodeHook > | m_callbacks |
| Collection of standard callback functions. | |
| std::vector< std::pair< NodeHook, NodeCondition > > | m_conditional_callbacks |
| Collection of conditional callback functions with their predicates. | |
| bool | m_networked_node {} |
| Flag indicating if the node is part of a NodeNetwork This flag is used to disable event firing when the node is managed within a NodeNetwork, preventing redundant or conflicting event notifications. | |
| bool | m_state_saved {} |
| tracks if the node's state has been saved by a snapshot operation | |
| uint32_t | m_sample_rate { 48000 } |
| Sample rate for audio processing, used for normalization. | |
| uint8_t | m_node_capability { NodeCapability::SCALAR } |
| Bitmask of capabilities declared by this node. | |
Connects an ordered sequence of nodes in series.
ChainNode represents a sequential processing chain of arbitrary length. The output of each node becomes the input to the next.
When a NodeGraphManager is provided at construction, initialize() handles registration and semantics application through the manager directly. Without a manager, initialize() only sets internal state, suitable for manual processing or Lila contexts that manage their own graph.
The >> operator (defined in API/Graph.hpp) detects existing ChainNodes and appends to the sequence rather than creating nested chains.
Definition at line 26 of file NodeChain.hpp.