diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2022-01-09 12:28:19 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2022-01-09 12:28:19 -0500 |
commit | 1b176cf6cd75c8031a140961655cdd3c16589a68 (patch) | |
tree | 8415664e40a9a768d8c3a35fd81252bfdefb72f9 /templates/1_convolve_simple.cpp | |
parent | fde531e7c44ea917f745a9f800178fbe83fa19b5 (diff) |
small changes; sig gen square(), triangle(), pulse()
Diffstat (limited to 'templates/1_convolve_simple.cpp')
-rw-r--r-- | templates/1_convolve_simple.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/templates/1_convolve_simple.cpp b/templates/1_convolve_simple.cpp deleted file mode 100644 index 8de05d3..0000000 --- a/templates/1_convolve_simple.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 1_convolve_simple.cpp - * Written by Clyne Sullivan. - * - * Computes a convolution in the simplest way possible. While the code is brief, it lacks many - * possible optimizations. The convolution's result will not fill the output buffer either, as the - * transient response is not calculated. - */ - -Sample *process_data(Samples samples) -{ - // Define our output buffer. SIZE is the largest size of the 'samples' buffer. - static Sample buffer[samples.size()]; - - // Define our filter - constexpr unsigned int filter_size = 3; - float filter[filter_size] = { - 0.3333, 0.3333, 0.3333 - }; - - // Begin convolving: - for (int n = 0; n < samples.size() - (filter_size - 1); n++) { - buffer[n] = 0; - for (int k = 0; k < filter_size; k++) - buffer[n] += samples[n + k] * filter[k]; - } - - return buffer; -} |