ladspa-pitchshift/effect.cpp
2023-10-30 06:52:43 +06:00

31 lines
864 B
C++

#include "effect.h"
#include "mengumath.h"
Mengu::dsp::EffectChain::EffectChain(uint32_t buffer_size) {
_buffer_size = Mengu::last_pow_2(buffer_size);
_input_buffer.resize(_buffer_size);
_transformed_buffer.resize(_buffer_size);
}
Mengu::dsp::EffectChain::~EffectChain() {
for (auto effect: _effects) {
}
}
void Mengu::dsp::EffectChain::push_signal(const Complex *input, const uint32_t &size) {
for (uint32_t i = 0; i < size; i++) {
_input_buffer.push_back(input[i]);
}
}
void Mengu::dsp::EffectChain::pop_transformed_signal(Complex *output, const uint32_t &size) {
for (uint32_t i = _buffer_size - size; i < _buffer_size; i++) {
output[i] = _transformed_buffer[i];
}
}
void Mengu::dsp::EffectChain::append_effect(Effect *effect) {
_effects.push_back(effect);
}