MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::NetworkAudioProcessor Class Reference

Processor that bridges NodeNetwork batch output into an AudioBuffer. More...

#include <NetworkAudioBuffer.hpp>

+ Inheritance diagram for MayaFlux::Buffers::NetworkAudioProcessor:
+ Collaboration diagram for MayaFlux::Buffers::NetworkAudioProcessor:

Public Member Functions

 NetworkAudioProcessor (std::shared_ptr< Nodes::Network::NodeNetwork > network, float mix=1.0F, bool clear_before_process=true)
 Creates a processor connected to a NodeNetwork.
 
void processing_function (const std::shared_ptr< Buffer > &buffer) override
 Drives or reads network batch output into the buffer.
 
void set_mix (float mix)
 
float get_mix () const
 
void on_attach (const std::shared_ptr< Buffer > &buffer) override
 Called when this processor is attached to a buffer.
 
void on_detach (const std::shared_ptr< Buffer > &buffer) override
 Called when this processor is detached from a buffer.
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 
void process (const std::shared_ptr< Buffer > &buffer)
 Applies a computational transformation to the data in the provided buffer.
 
virtual void set_processing_token (ProcessingToken token)
 Gets the preferred processing backend for this processor.
 
virtual ProcessingToken get_processing_token () const
 Gets the current processing token for this buffer.
 
virtual bool is_compatible_with (const std::shared_ptr< Buffer > &) const
 Checks if this processor can handle the specified buffer type.
 

Private Attributes

std::shared_ptr< Nodes::Network::NodeNetworkm_network
 
float m_mix
 
bool m_clear_before_process
 
bool m_self_processing {}
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Processor that bridges NodeNetwork batch output into an AudioBuffer.

NetworkAudioProcessor drives or reads the batch output from a NodeNetwork into an AudioBuffer. If the network has already been processed this cycle (e.g. by NodeGraphManager during AUDIO_RATE processing), the processor reads the cached result. If not, the processor drives process_batch() itself, making the buffer work regardless of whether the network is registered with NodeGraphManager.

This mirrors the guard pattern used by NodeGraphManager: check is_processed_this_cycle(), then mark_processing/process_batch/ mark_processed. If another context is currently processing, the processor returns immediately rather than blocking.

The processor respects the network's routing state, applying per-channel scaling when the network is undergoing a routing transition. The mix parameter controls interpolation between existing buffer content and incoming network output.

Processing sequence per cycle:

  1. Validate network has AUDIO_SINK or AUDIO_COMPUTE output mode
  2. Optionally clear buffer (clear_before_process)
  3. Ensure network is initialized
  4. Drive process_batch() if not yet processed this cycle
  5. Read cached batch output via get_audio_buffer()
  6. Apply routing scale for the buffer's channel if active
  7. Mix into buffer data with configured mix level

Definition at line 42 of file NetworkAudioBuffer.hpp.


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