...and more pass-by-reference.

Another 176 bytes!
This commit is contained in:
Jared Boone 2016-01-04 11:04:28 -08:00
parent 05a1c22426
commit 359fb6f3c6
4 changed files with 6 additions and 6 deletions

View File

@ -23,7 +23,7 @@
#include <hal.h>
void IIRBiquadFilter::execute(buffer_s16_t buffer_in, buffer_s16_t buffer_out) {
void IIRBiquadFilter::execute(const buffer_s16_t& buffer_in, const buffer_s16_t& buffer_out) {
// TODO: Assert that buffer_out.count == buffer_in.count.
for(size_t i=0; i<buffer_out.count; i++) {
const int32_t output_sample = execute_sample(buffer_in.p[i]);
@ -32,7 +32,7 @@ void IIRBiquadFilter::execute(buffer_s16_t buffer_in, buffer_s16_t buffer_out) {
}
}
void IIRBiquadFilter::execute_in_place(buffer_s16_t buffer) {
void IIRBiquadFilter::execute_in_place(const buffer_s16_t& buffer) {
execute(buffer, buffer);
}

View File

@ -42,8 +42,8 @@ public:
{
}
void execute(buffer_s16_t buffer_in, buffer_s16_t buffer_out);
void execute_in_place(buffer_s16_t buffer);
void execute(const buffer_s16_t& buffer_in, const buffer_s16_t& buffer_out);
void execute_in_place(const buffer_s16_t& buffer);
private:
const iir_biquad_config_t config;

View File

@ -24,7 +24,7 @@
#include <cstdint>
#include <array>
bool FMSquelch::execute(buffer_s16_t audio) {
bool FMSquelch::execute(const buffer_s16_t& audio) {
// TODO: No hard-coded array size.
std::array<int16_t, N> squelch_energy_buffer;
const buffer_s16_t squelch_energy {

View File

@ -31,7 +31,7 @@
class FMSquelch {
public:
bool execute(buffer_s16_t audio);
bool execute(const buffer_s16_t& audio);
void set_threshold(const uint32_t new_value);