Add IIR execute_in_place()

This commit is contained in:
Jared Boone 2015-07-20 09:33:56 -07:00
parent 71990b380a
commit 876a591a66
2 changed files with 11 additions and 6 deletions

View File

@ -39,12 +39,17 @@ public:
{ {
} }
void execute(buffer_s16_t buffer) { void execute(buffer_s16_t buffer_in, buffer_s16_t buffer_out) {
for(size_t i=0; i<buffer.count; i++) { // TODO: Assert that buffer_out.count == buffer_in.count.
buffer.p[i] = execute_sample(buffer.p[i]); for(size_t i=0; i<buffer_out.count; i++) {
buffer_out.p[i] = execute_sample(buffer_in.p[i]);
} }
} }
void execute_in_place(buffer_s16_t buffer) {
execute(buffer, buffer);
}
private: private:
const std::array<float, 3> b; const std::array<float, 3> b;
const std::array<float, 3> a; const std::array<float, 3> a;

View File

@ -453,7 +453,7 @@ public:
* -> 48kHz int16_t[32] */ * -> 48kHz int16_t[32] */
auto audio = demod.execute(channel, work_audio_buffer); auto audio = demod.execute(channel, work_audio_buffer);
audio_hpf.execute(audio); audio_hpf.execute_in_place(audio);
feed_audio_stats(audio); feed_audio_stats(audio);
fill_audio_buffer(audio); fill_audio_buffer(audio);
} }
@ -502,7 +502,7 @@ public:
* -> 48kHz int16_t[32] */ * -> 48kHz int16_t[32] */
auto audio = demod.execute(channel, work_audio_buffer); auto audio = demod.execute(channel, work_audio_buffer);
audio_hpf.execute(audio); audio_hpf.execute_in_place(audio);
feed_audio_stats(audio); feed_audio_stats(audio);
fill_audio_buffer(audio); fill_audio_buffer(audio);
} }
@ -565,7 +565,7 @@ public:
auto audio = audio_filter.execute(audio_2fs, work_audio_buffer); auto audio = audio_filter.execute(audio_2fs, work_audio_buffer);
/* -> 48kHz int16_t[32] */ /* -> 48kHz int16_t[32] */
audio_hpf.execute(audio); audio_hpf.execute_in_place(audio);
feed_audio_stats(audio); feed_audio_stats(audio);
fill_audio_buffer(audio); fill_audio_buffer(audio);
} }