Skip to content

Commit

Permalink
[common] update the common code to work with the new streaming api.
Browse files Browse the repository at this point in the history
This is just an interim until I rework the buffer code to stream directly into the library
  • Loading branch information
gnif committed Mar 11, 2019
1 parent a443c81 commit cc580ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/common/src/RnNoiseCommonPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/rnnoise/src/denoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit cc580ad

Please sign in to comment.