Processes an audio buffer using the polynomial function.
Applies the polynomial transformation to the buffer data according to the configured processing mode and parameters.
38{
39 if (!
m_polynomial || !buffer || std::dynamic_pointer_cast<AudioBuffer>(buffer)->get_data().empty()) {
40 return;
41 }
46 }
47
48 auto& data = std::dynamic_pointer_cast<AudioBuffer>(buffer)->get_data();
49
52 process_span(std::span<double>(data.data(), data.size()));
53 break;
54
57 process_span(std::span<double>(data.data(), data.size()));
58 break;
59
61 std::span<double> data_span { data };
62 for (
size_t window_start = 0; window_start < data_span.size(); window_start +=
m_window_size) {
64 size_t window_size = std::min(
m_window_size, data_span.size() - window_start);
65 process_span(data_span.subspan(window_start, window_size));
66 }
67 break;
68 }
70 m_polynomial->set_buffer_context(std::span<double>(data.data(), data.size()));
71 process_span(std::span<double>(data.data(), data.size()));
73 break;
74 }
75 }
76}
bool m_use_internal
Whether to use the buffer's internal previous state.
void process_span(std::span< double > data)
Processes a span of data using the polynomial function.
size_t m_window_size
Window size for windowed processing.
@ BATCH
Process the entire buffer at once.
@ SAMPLE_BY_SAMPLE
Process each sample individually.
@ WINDOWED
Process using a sliding window.
@ BUFFER_CONTEXT
Process each sample with access to buffer history.
std::shared_ptr< Nodes::Generator::Polynomial > m_pending_polynomial
Internal polynomial node.
std::shared_ptr< Nodes::Generator::Polynomial > m_polynomial
Polynomial node for processing.
ProcessMode m_process_mode
Current processing mode.