Audaspace 1.5.0
A high level audio library.
|
This class allows to convolve a sound with a very large impulse response. More...
#include <Convolver.h>
Public Member Functions | |
Convolver (std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > ir, int irLength, std::shared_ptr< ThreadPool > threadPool, std::shared_ptr< FFTPlan > plan) | |
Creates a new FFTConvolver. | |
void | getNext (sample_t *inBuffer, sample_t *outBuffer, int &length, bool &eos) |
Convolves the data that is provided with the inpulse response. | |
void | reset () |
Resets all the internally stored data so the convolution of a new sound can be started. | |
std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > | getImpulseResponse () |
Retrieves the current impulse response being used. | |
void | setImpulseResponse (std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > ir) |
Changes the impulse response and resets the convolver. | |
This class allows to convolve a sound with a very large impulse response.
Convolver::Convolver | ( | std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > | ir, |
int | irLength, | ||
std::shared_ptr< ThreadPool > | threadPool, | ||
std::shared_ptr< FFTPlan > | plan ) |
Creates a new FFTConvolver.
ir | A shared pointer to a vector with the data of the various impulse response parts in the frequency domain (see ImpulseResponse class for an easy way to obtain it). |
irLength | The length of the full impulse response. |
threadPool | A shared pointer to a ThreadPool object with 1 or more threads. |
plan | A shared pointer to a FFT plan that will be used for convolution. |
std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > Convolver::getImpulseResponse | ( | ) |
Retrieves the current impulse response being used.
Convolves the data that is provided with the inpulse response.
Given a plan of size N, the amount of samples convolved by one call to this method will be N/2.
[in] | inBuffer | A buffer with the input data to be convolved, nullptr if the source sound has ended (the convolved sound is larger than the source sound). |
[in] | outBuffer | A buffer in which the convolved data will be written. Its size must be at least N/2. |
[in,out] | length | The number of samples you wish to obtain. If an inBuffer is provided this argument must match its length. When this method returns, the value of length represents the number of samples written into the outBuffer. |
[out] | eos | True if the end of the sound is reached, false otherwise. |
void Convolver::setImpulseResponse | ( | std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > | ir | ) |
Changes the impulse response and resets the convolver.
ir | A shared pointer to a vector with the data of the various impulse response parts in the frequency domain (see ImpulseResponse class for an easy way to obtain it). |