FFT convolver using two different block sizes. More...
Inherited by MultithreadedConvolver.
Public Member Functions | |
void | cleanPipeline () |
Clears the internal buffers so that it resets the convolution pipeline. More... | |
bool | init (size_t headBlockSize, size_t tailBlockSize, const Sample *ir, size_t irLen) |
Initialization the convolver. More... | |
void | process (const Sample *input, Sample *output, size_t len) |
Convolves the the given input samples and immediately outputs the result. More... | |
void | reset () |
Resets the convolver and discards the set impulse response. | |
Protected Member Functions | |
void | doBackgroundProcessing () |
Actually performs the background processing work. | |
virtual void | startBackgroundProcessing () |
Method called by the convolver if work for background processing is available. More... | |
virtual void | waitForBackgroundProcessing () |
Called by the convolver if it expects the result of its previous call to startBackgroundProcessing() More... | |
FFT convolver using two different block sizes.
The 2-stage convolver consists internally of two convolvers:
Using a short block size for the head convolver and a long block size for the tail convolver results in much less CPU usage, while keeping the calculation time of each processing call short.
Furthermore, this convolver class provides virtual methods which provide the possibility to move the tail convolution into the background (e.g. by using multithreading, see startBackgroundProcessing()/waitForBackgroundProcessing()).
As well as the basic FFTConvolver class, the 2-stage convolver is suitable for real-time processing which means that no "unpredictable" operations like allocations, locking, API calls, etc. are performed during processing (all necessary allocations and preparations take place during initialization).
void cleanPipeline | ( | ) |
Clears the internal buffers so that it resets the convolution pipeline.
bool init | ( | size_t | headBlockSize, |
size_t | tailBlockSize, | ||
const Sample * | ir, | ||
size_t | irLen | ||
) |
Initialization the convolver.
headBlockSize | The head block size |
tailBlockSize | the tail block size |
ir | The impulse response |
irLen | Length of the impulse response in samples |
void process | ( | const Sample * | input, |
Sample * | output, | ||
size_t | len | ||
) |
Convolves the the given input samples and immediately outputs the result.
input | The input samples |
output | The convolution result |
len | Number of input/output samples |
|
protectedvirtual |
Method called by the convolver if work for background processing is available.
The default implementation just calls doBackgroundProcessing() to perform the "bulk" convolution. However, if you want to perform the majority of work in some background thread (which is recommended), you can overload this method and trigger the execution of doBackgroundProcessing() really in some background thread.
|
protectedvirtual |
Called by the convolver if it expects the result of its previous call to startBackgroundProcessing()
After returning from this method, all background processing has to be completed.