From cc580ad847039a0805253fdb28edb05539ce004a Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 11 Mar 2019 18:19:20 +1100 Subject: [PATCH] [common] update the common code to work with the new streaming api. This is just an interim until I rework the buffer code to stream directly into the library --- src/common/src/RnNoiseCommonPlugin.cpp | 9 +++------ src/rnnoise/src/denoise.c | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/common/src/RnNoiseCommonPlugin.cpp b/src/common/src/RnNoiseCommonPlugin.cpp index de66f86a..20d0690b 100644 --- a/src/common/src/RnNoiseCommonPlugin.cpp +++ b/src/common/src/RnNoiseCommonPlugin.cpp @@ -168,12 +168,9 @@ void RnNoiseCommonPlugin::process(const float *in, float *out, int32_t sampleFra leftLen = k_denoiseFrameSize; const int rightLen = k_denoiseFrameSize - leftLen; - rnnoise_process_frame( - m_denoiseState.get(), - &m_outBuffer[m_outBufferW], - &m_inBuffer[m_inBufferR], leftLen, - &m_inBuffer[0] , rightLen - ); + rnnoise_add_samples (m_denoiseState.get(), &m_inBuffer[m_inBufferR], leftLen ); + rnnoise_add_samples (m_denoiseState.get(), &m_inBuffer[0] , rightLen); + rnnoise_process_frame(m_denoiseState.get(), &m_outBuffer[m_outBufferW]); // scale the levels back to normal for(int32_t i = 0; i < k_denoiseFrameSize; ++i) diff --git a/src/rnnoise/src/denoise.c b/src/rnnoise/src/denoise.c index e1866794..168a5975 100644 --- a/src/rnnoise/src/denoise.c +++ b/src/rnnoise/src/denoise.c @@ -483,7 +483,7 @@ int rnnoise_add_samples(DenoiseState *st, const float *in, int in_len) { const int needed = FRAME_SIZE - st->input_pos; const int take = needed > in_len ? in_len : needed; - biquad(st->input + st->input_pos, st->mem_hp_x, in, b_hp, a_hp, in_len); + biquad(st->input + st->input_pos, st->mem_hp_x, in, b_hp, a_hp, take); return take; }