MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ processing_function()

void MayaFlux::Buffers::NodeSourceProcessor::processing_function ( const std::shared_ptr< Buffer > &  buffer)
overridevirtual

Captures node computation output into a buffer.

Parameters
bufferBuffer to store the processed data

This method implements a configurable data flow pattern:

  1. Optionally resets the buffer if clear_before_process is true
  2. Generates sequential values from the computational node
  3. Applies the specified interpolation between existing and incoming data

Implements MayaFlux::Buffers::BufferProcessor.

Definition at line 30 of file NodeBuffer.cpp.

31{
32 if (!m_node) {
33 MF_RT_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing, "NodeSourceProcessor has null node. Skipping processing.");
34 return;
35 }
36
37 try {
38 auto& buffer_data = std::dynamic_pointer_cast<AudioBuffer>(buffer)->get_data();
39
40 bool should_clear = m_clear_before_process;
41 if (auto node_buffer = std::dynamic_pointer_cast<NodeBuffer>(buffer)) {
42 should_clear = node_buffer->get_clear_before_process();
43 }
44
45 if (should_clear) {
46 buffer->clear();
47 }
48
50
51 } catch (const std::exception& e) {
52 error_rethrow(Journal::Component::Buffers, Journal::Context::BufferProcessing, std::source_location::current(), "Error processing node: {}", e.what());
53 }
54}
#define MF_RT_ERROR(comp, ctx,...)
bool m_clear_before_process
Whether to reset the buffer before adding node output.
float m_mix
Interpolation coefficient between existing and incoming data (0.0-1.0)
std::shared_ptr< Nodes::Node > m_node
Source node that generates sequential data values.
void update_buffer_with_node_data(const std::shared_ptr< Nodes::Node > &node, std::span< double > buffer, double mix)
Apply node output to an existing buffer with mixing.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_clear_before_process, m_mix, m_node, MF_RT_ERROR, and MayaFlux::Buffers::update_buffer_with_node_data().

+ Here is the call graph for this function: