aboutsummaryrefslogtreecommitdiffstats
path: root/templates/3_fir.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-08-08 22:12:53 -0400
committerClyne Sullivan <clyne@bitgloo.com>2021-08-08 22:12:53 -0400
commitbf0a126e8a9d30b77007829166f4bf91a3900079 (patch)
tree9d4a769daca81393a4562e96d9c2efb96092100a /templates/3_fir.cpp
parent707b24dd07236243269cf092728f85172e94e8a4 (diff)
update templates to new api; open template status fix
Diffstat (limited to 'templates/3_fir.cpp')
-rw-r--r--templates/3_fir.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/templates/3_fir.cpp b/templates/3_fir.cpp
index 7af66a8..3a68500 100644
--- a/templates/3_fir.cpp
+++ b/templates/3_fir.cpp
@@ -7,9 +7,9 @@
* within the available execution time. Samples are also normalized so that they center around zero.
*/
-adcsample_t *process_data(adcsample_t *samples, unsigned int size)
+Sample *process_data(Samples samples)
{
- static adcsample_t buffer[SIZE];
+ static Sample buffer[samples.size()];
// Define the filter:
constexpr unsigned int filter_size = 3;
@@ -19,9 +19,9 @@ adcsample_t *process_data(adcsample_t *samples, unsigned int size)
};
// Do an overlap-save convolution
- static adcsample_t prev[filter_size];
+ static Sample prev[filter_size];
- for (int n = 0; n < size; n++) {
+ for (int n = 0; n < samples.size(); n++) {
// Using a float variable for accumulation allows for better code optimization
float v = 0;
@@ -40,7 +40,7 @@ adcsample_t *process_data(adcsample_t *samples, unsigned int size)
// Save samples for next convolution
for (int i = 0; i < filter_size; i++)
- prev[i] = samples[size - filter_size + i];
+ prev[i] = samples[samples.size() - filter_size + i];
return buffer;
}