aboutsummaryrefslogtreecommitdiffstats
path: root/examples/2_convolve_overlap_save.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2022-05-22 13:37:49 -0400
committerClyne Sullivan <clyne@bitgloo.com>2022-05-22 13:37:49 -0400
commitf211f9628854b417000192c59d6ab22b946119b1 (patch)
tree9cd7ae6cb2a6598b056087389e0497026ad9d4c5 /examples/2_convolve_overlap_save.cpp
parent660d967ec0ac79ea2a43946be4c056ef2d21ffc4 (diff)
make helper funcs inline; drop std::span for algo
Diffstat (limited to 'examples/2_convolve_overlap_save.cpp')
-rw-r--r--examples/2_convolve_overlap_save.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/2_convolve_overlap_save.cpp b/examples/2_convolve_overlap_save.cpp
index 57c020a..5651f3e 100644
--- a/examples/2_convolve_overlap_save.cpp
+++ b/examples/2_convolve_overlap_save.cpp
@@ -11,9 +11,9 @@
* computation.
*/
-Sample *process_data(Samples samples)
+Sample* process_data(Samples samples)
{
- static Sample buffer[samples.size()];
+ static Samples buffer;
constexpr unsigned int filter_size = 3;
float filter[filter_size] = {
@@ -23,7 +23,7 @@ Sample *process_data(Samples samples)
// Keep a buffer of extra samples for overlap-save
static Sample prev[filter_size];
- for (int n = 0; n < samples.size(); n++) {
+ for (int n = 0; n < SIZE; n++) {
buffer[n] = 0;
for (int k = 0; k < filter_size; k++) {
@@ -40,7 +40,7 @@ Sample *process_data(Samples samples)
// Save samples for the next convolution run
for (int i = 0; i < filter_size; i++)
- prev[i] = samples[samples.size() - filter_size + i];
+ prev[i] = samples[SIZE - filter_size + i];
return buffer;
}