MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nodes::ChainNode Class Reference

Connects two nodes in series to form a processing chain. More...

#include <NodeStructure.hpp>

+ Inheritance diagram for MayaFlux::Nodes::ChainNode:
+ Collaboration diagram for MayaFlux::Nodes::ChainNode:

Public Member Functions

 ChainNode (const std::shared_ptr< Node > &source, const std::shared_ptr< Node > &target)
 Creates a new chain connecting source to target.
 
void initialize ()
 Initializes the chain node.
 
double process_sample (double input=0.) override
 Processes a single sample through the chain.
 
std::vector< double > process_batch (unsigned int num_samples) override
 Processes multiple samples through the chain.
 
void on_tick (const NodeHook &callback) override
 Registers a callback for every output sample.
 
void on_tick_if (const NodeHook &callback, const NodeCondition &condition) override
 Registers a conditional callback for output samples.
 
bool remove_hook (const NodeHook &callback) override
 Removes a previously registered callback.
 
bool remove_conditional_hook (const NodeCondition &callback) override
 Removes a previously registered 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.
 
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 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.
 
NodeContextget_last_context ()
 Retrieves the last created context object.
 
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.
 

Protected Member Functions

void notify_tick (double) override
 Empty implementation of notify_tick.
 
std::unique_ptr< NodeContextcreate_context (double) override
 Empty implementation of create_context.
 
- 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::shared_ptr< Nodem_Source
 The upstream node that processes input first.
 
std::shared_ptr< Nodem_Target
 The downstream node that processes the source's output.
 
bool m_is_initialized
 Flag indicating whether the chain has been properly 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< Utils::NodeStatem_state { Utils::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::unique_ptr< NodeContextm_last_context
 The last context object created for callbacks.
 
std::vector< float > m_gpu_data_buffer
 GPU data buffer for context objects.
 
std::vector< NodeHookm_callbacks
 Collection of standard callback functions.
 
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
 Collection of conditional callback functions with their predicates.
 

Detailed Description

Connects two nodes in series to form a processing chain.

The ChainNode implements the Node interface and represents a connection between two nodes where the output of the source node becomes the input to the target node. This is the implementation behind the '>>' operator for nodes.

When processed, the ChainNode:

  1. Passes the input to the source node
  2. Takes the output from the source node
  3. Passes that as input to the target node
  4. Returns the output from the target node

Definition at line 21 of file NodeStructure.hpp.


The documentation for this class was generated from the following files: