diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:12:53 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:12:53 -0400 |
commit | bf0a126e8a9d30b77007829166f4bf91a3900079 (patch) | |
tree | 9d4a769daca81393a4562e96d9c2efb96092100a /templates/7_iir_echo.cpp | |
parent | 707b24dd07236243269cf092728f85172e94e8a4 (diff) |
update templates to new api; open template status fix
Diffstat (limited to 'templates/7_iir_echo.cpp')
-rw-r--r-- | templates/7_iir_echo.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/templates/7_iir_echo.cpp b/templates/7_iir_echo.cpp index 8e93b35..57e5605 100644 --- a/templates/7_iir_echo.cpp +++ b/templates/7_iir_echo.cpp @@ -1,22 +1,22 @@ -adcsample_t *process_data(adcsample_t *samples, unsigned int size) +Sample *process_data(Samples samples) { constexpr float alpha = 0.75; constexpr unsigned int D = 100; - static adcsample_t output[SIZE]; - static adcsample_t prev[D]; // prev[0] = output[0 - D] + static Sample output[samples.size()]; + static Sample prev[D]; // prev[0] = output[0 - D] // Do calculations with previous output for (unsigned int i = 0; i < D; i++) output[i] = samples[i] + alpha * (prev[i] - 2048); // Do calculations with current samples - for (unsigned int i = D; i < size; i++) + for (unsigned int i = D; i < samples.size(); i++) output[i] = samples[i] + alpha * (output[i - D] - 2048); // Save outputs for next computation for (unsigned int i = 0; i < D; i++) - prev[i] = output[size - (D - i)]; + prev[i] = output[samples.size() - (D - i)]; return output; } |