Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Convolver Class Reference

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.
 

Detailed Description

This class allows to convolve a sound with a very large impulse response.

Constructor & Destructor Documentation

◆ Convolver()

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.

Parameters
irA 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).
irLengthThe length of the full impulse response.
threadPoolA shared pointer to a ThreadPool object with 1 or more threads.
planA shared pointer to a FFT plan that will be used for convolution.

Member Function Documentation

◆ getImpulseResponse()

std::shared_ptr< std::vector< std::shared_ptr< std::vector< std::complex< sample_t > > > > > Convolver::getImpulseResponse ( )

Retrieves the current impulse response being used.

Returns
The current impulse response.

◆ getNext()

void Convolver::getNext ( sample_t * inBuffer,
sample_t * outBuffer,
int & length,
bool & eos )

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.

Parameters
[in]inBufferA 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]outBufferA buffer in which the convolved data will be written. Its size must be at least N/2.
[in,out]lengthThe 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]eosTrue if the end of the sound is reached, false otherwise.

◆ setImpulseResponse()

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.

Parameters
irA 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).

The documentation for this class was generated from the following file: