|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Base interface for all computational processing nodes. More...
#include <Node.hpp>
Inheritance diagram for MayaFlux::Nodes::Node:
Collaboration diagram for MayaFlux::Nodes::Node:Public Member Functions | |
| virtual | ~Node ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual double | process_sample (double input=0.)=0 |
| Processes a single data sample. | |
| virtual std::vector< double > | process_batch (unsigned int num_samples)=0 |
| Processes multiple samples at once. | |
| virtual void | on_tick (const NodeHook &callback) |
| Registers a callback to be called on each tick. | |
| virtual void | on_tick_if (const NodeHook &callback, const NodeCondition &condition) |
| Registers a conditional callback. | |
| 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 void | remove_all_hooks () |
| Removes all registered callbacks. | |
| virtual void | reset_processed_state () |
| Resets the processed state of the node and any attached input nodes. | |
| 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. | |
| NodeContext & | get_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. | |
| virtual void | save_state ()=0 |
| Saves the node's current state for later restoration Recursively cascades through all connected modulator nodes Protected - only NodeSourceProcessor and NodeBuffer can call. | |
| virtual void | restore_state ()=0 |
| Restores the node's state from the last save Recursively cascades through all connected modulator nodes Protected - only NodeSourceProcessor and NodeBuffer can call. | |
Public Attributes | |
| 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::NodeState > | m_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 Member Functions | |
| virtual std::unique_ptr< NodeContext > | create_context (double value)=0 |
| Creates an appropriate context object for this node type. | |
| virtual void | notify_tick (double value)=0 |
| Notifies all registered callbacks with the current context. | |
| virtual void | reset_processed_state_internal () |
| Resets the processed state of the node directly. | |
Protected Attributes | |
| 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< NodeContext > | m_last_context |
| The last context object created for callbacks. | |
| 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. | |
Private Attributes | |
| std::atomic< uint32_t > | m_active_channels_mask { 0 } |
| Bitmask tracking which channels are currently using this node. | |
| std::atomic< uint32_t > | m_pending_reset_mask { 0 } |
| Bitmask tracking which channels have requested a reset. | |
Base interface for all computational processing nodes.
The Node class defines the fundamental interface for all processing components in the MayaFlux engine. Nodes are the basic building blocks of transformation chains and can be connected together to create complex computational graphs.
Each node processes data on a sample-by-sample basis, allowing for flexible real-time processing. Nodes can be:
The node system supports both single-sample processing for real-time applications and batch processing for more efficient offline processing.