Add invert phase DSP filter

replace/57c536028544f4f2a99f0837c1082a81ba0d8d42
Niccolò Izzo 2021-06-27 19:00:06 +02:00 zatwierdzone przez Silvano Seva
rodzic be21364b30
commit 3439f3a497
2 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -54,6 +54,15 @@ void dsp_pwmCompensate(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
}

Wyświetl plik

@ -57,9 +57,11 @@ void dsp_applyFIR(audio_sample_t *buffer,
uint16_t length,
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;
for(uint16_t j = 0; j < order; j++) {
for(uint16_t j = 0; j < order; j++)
{
if (i >= j)
acc += buffer[i - j] * taps[j];
}