Processes a buffer by applying the recursive algorithm.
- Parameters
-
This method:
- Combines the current state with the stored previous state
- Stores the resulting output as the new previous state
The combination is weighted by the feedback coefficient, with higher values resulting in stronger influence from the previous state.
Implements MayaFlux::Buffers::BufferProcessor.
Definition at line 38 of file FeedbackBuffer.cpp.
39{
40 auto audio_buffer = std::dynamic_pointer_cast<AudioBuffer>(buffer);
41 if (!audio_buffer)
42 return;
43
44 std::vector<double>* previous_data = nullptr;
45 auto& buffer_data = audio_buffer->get_data();
46
47 if (auto feedback_buffer = std::dynamic_pointer_cast<FeedbackBuffer>(buffer)) {
48 previous_data = &feedback_buffer->get_previous_buffer();
50 } else {
54 }
56 }
57
58 for (double& sample : buffer_data) {
60
62
65 output_sample = (output_sample + (*previous_data)[next_index]) * 0.5;
66 }
67
68 sample = output_sample;
69
71
73 }
74}
bool m_using_internal_buffer
Flag indicating whether to use the buffer's internal previous state.
uint32_t m_feed_samples
Number of samples to feed back.
std::vector< double > m_previous_buffer
Storage for the previous system state.
float m_feedback_amount
Feedback coefficient (0.0-1.0)
References m_buffer_index, m_feed_samples, m_feedback_amount, m_previous_buffer, and m_using_internal_buffer.