Filter is an IIR filter based on the typical direct form 1 formula: y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2] It doesn't allocate any internal buffers and needs just a few bytes of memory.
More...
#include "SuperpoweredFilter.h"
|
float | decibel |
| Decibel gain value for shelving and parametric filters. Limit: -96 to 24. More...
|
|
bool | enabled = false |
| Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation. More...
|
|
float | frequency |
| Frequency in Hz. From 1 Hz to the half of the current sample rate. More...
|
|
float | octave |
| Width in octave for bandlimited and parametric filters. Limit: 0.05 to 5. More...
|
|
float | resonance |
| Resonance value for resonant filters. Resonance = Q / 10. Limit: 0.01 to 1. More...
|
|
unsigned int | samplerate = 0 |
| Sample rate in Hz. More...
|
|
float | slope |
| Slope value for shelving filters. Limit: 0.001 to 1. More...
|
|
FilterType | type |
| Filter type. Changing the filter type often involves changing other parameters as well. Therefore in a real-time context change the parameters and the type in the same thread with the process() call. More...
|
|
Filter is an IIR filter based on the typical direct form 1 formula: y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2] It doesn't allocate any internal buffers and needs just a few bytes of memory.
◆ Filter() [1/2]
Superpowered::Filter::Filter |
( |
FilterType |
filterType, |
|
|
unsigned int |
samplerate |
|
) |
| |
Constructor.
Enabled is false by default.
- Parameters
-
filterType | The initial filter type. |
samplerate | The initial sample rate in Hz. |
◆ ~Filter()
Superpowered::Filter::~Filter |
( |
| ) |
|
◆ Filter() [2/2]
Superpowered::Filter::Filter |
( |
const Filter & |
| ) |
|
|
protected |
◆ operator=()
◆ process()
bool Superpowered::Filter::process |
( |
float * |
input, |
|
|
float * |
output, |
|
|
unsigned int |
numberOfFrames |
|
) |
| |
|
virtual |
Processes interleaved stereo audio.
Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation. It's never blocking for real-time usage. You can change all properties on any thread, concurrently with process(). Do not call any method concurrently with process().
- Returns
- If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.
- Parameters
-
input | Pointer to floating point numbers. 32-bit interleaved stereo input. |
output | Pointer to floating point numbers. 32-bit interleaved stereo output. Can point to the same location with input (in-place processing). |
numberOfFrames | Number of frames to process. Recommendations for best performance: multiply of 4, minimum 64. |
Implements Superpowered::FX.
◆ processMono()
bool Superpowered::Filter::processMono |
( |
float * |
input, |
|
|
float * |
output, |
|
|
unsigned int |
numberOfFrames |
|
) |
| |
Processes mono audio.
Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation. It's never blocking for real-time usage. You can change all properties on any thread, concurrently with process(). Do not call any method concurrently with process().
- Returns
- If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.
- Parameters
-
input | Pointer to floating point numbers. 32-bit mono input. |
output | Pointer to floating point numbers. 32-bit mono output. Can point to the same location with input (in-place processing). |
numberOfFrames | Number of frames to process. Recommendations for best performance: multiply of 4, minimum 64. |
◆ setCustomCoefficients()
void Superpowered::Filter::setCustomCoefficients |
( |
float |
b0, |
|
|
float |
b1, |
|
|
float |
b2, |
|
|
float |
a1, |
|
|
float |
a2 |
|
) |
| |
For advanced use.
Set custom coefficients for the filter. Changes will be smoothly handled to prevent audio artifacts. Do not call this concurrently with process().
- Parameters
-
b0 | b0/a0 |
b1 | b1/a0 |
b2 | b2/a0 |
a1 | a1/a0 |
a2 | a2/a0 |
◆ decibel
float Superpowered::Filter::decibel |
Decibel gain value for shelving and parametric filters. Limit: -96 to 24.
◆ enabled
bool Superpowered::FX::enabled = false |
|
inherited |
Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation.
◆ frequency
float Superpowered::Filter::frequency |
Frequency in Hz. From 1 Hz to the half of the current sample rate.
◆ internals
filterInternals* Superpowered::Filter::internals |
|
protected |
◆ octave
float Superpowered::Filter::octave |
Width in octave for bandlimited and parametric filters. Limit: 0.05 to 5.
◆ resonance
float Superpowered::Filter::resonance |
Resonance value for resonant filters. Resonance = Q / 10. Limit: 0.01 to 1.
◆ samplerate
unsigned int Superpowered::FX::samplerate = 0 |
|
inherited |
◆ slope
float Superpowered::Filter::slope |
Slope value for shelving filters. Limit: 0.001 to 1.
◆ type
Filter type. Changing the filter type often involves changing other parameters as well. Therefore in a real-time context change the parameters and the type in the same thread with the process() call.
The documentation for this class was generated from the following file:
- latest/Superpowered/SuperpoweredFilter.h