Convolver¶
class Convolver
Implementation of a partitioned FFT convolution algorithm with uniform block size.
Some notes on how to use it:
-
After initialization with an impulse response, subsequent data portions of arbitrary length can be convolved. The convolver internally can handle this by using appropriate buffering.
-
The convolver works without "latency" (except for the required processing time, of course), i.e. the output always is the convolved input for each processing call.
-
The 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).
Functions¶
| Name | Description |
|---|---|
| Convolver | Default constructor. |
| ~Convolver | Destructor. |
| Init | Initializes the convolver. |
| Process | Convolves the the given input samples and immediately outputs the result. |
| Reset | Resets the convolver state and discards the set impulse response. |
| GetSegmentSize | Gets the size of a single convolution segment. |
| GetSegmentCount | Gets the number of convolution segments. |
Function Details¶
Convolver¶
Convolver()
Default constructor.
Creates an uninitialized convolver.
GetSegmentCount¶
[[nodiscard]] AmSize GetSegmentCount() const
Gets the number of convolution segments.
- Return
- The number of convolution segments.
GetSegmentSize¶
[[nodiscard]] AmSize GetSegmentSize() const
Gets the size of a single convolution segment.
- Return
- The size of a single convolution segment.
Init¶
bool Init(AmSize blockSize, const AmAudioSample* ir, AmSize irLen)
Initializes the convolver.
- Parameter
blockSize - Block size internally used by the convolver (partition size)
- Parameter
ir - The impulse response
- Parameter
irLen - Length of the impulse response
- Return
truewhen the convolver is successfully initialized,falseotherwise.
Process¶
void Process(const AmAudioSample* input, AmAudioSample* output, AmSize len)
Convolves the the given input samples and immediately outputs the result.
- Parameter
input - The input samples.
- Parameter
output - The convolution result.
- Parameter
len - Number of input/output samples to process.
Reset¶
void Reset()
Resets the convolver state and discards the set impulse response.
The convolver will need to be initialized again after this call.
~Convolver¶
virtual ~Convolver()
Destructor.
Destroys the convolver and frees all allocated resources.