mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 23:17:49 +00:00
...and more pass-by-reference.
Another 176 bytes!
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 {
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user