Add invert phase DSP filter
This commit is contained in:
parent
be21364b30
commit
3439f3a497
|
|
@ -54,6 +54,15 @@ void dsp_pwmCompensate(audio_sample_t *buffer, size_t length);
|
||||||
*/
|
*/
|
||||||
void dsp_dcRemoval(audio_sample_t *buffer, size_t length);
|
void dsp_dcRemoval(audio_sample_t *buffer, size_t length);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inverts the phase of the audio buffer passed as paramenter.
|
||||||
|
* The buffer will be processed in place to save memory.
|
||||||
|
*
|
||||||
|
* @param buffer: the buffer to be used as both source and destination.
|
||||||
|
* @param length: the length of the input buffer.
|
||||||
|
*/
|
||||||
|
void dsp_invertPhase(audio_sample_t *buffer, uint16_t length);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,11 @@ void dsp_applyFIR(audio_sample_t *buffer,
|
||||||
uint16_t length,
|
uint16_t length,
|
||||||
std::array<float, order> taps)
|
std::array<float, order> taps)
|
||||||
{
|
{
|
||||||
for(int i = length - 1; i >= 0; i--) {
|
for(int i = length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
float acc = 0.0f;
|
float acc = 0.0f;
|
||||||
for(uint16_t j = 0; j < order; j++) {
|
for(uint16_t j = 0; j < order; j++)
|
||||||
|
{
|
||||||
if (i >= j)
|
if (i >= j)
|
||||||
acc += buffer[i - j] * taps[j];
|
acc += buffer[i - j] * taps[j];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue