From 2d8cedbd66a30f0c1ba39ea0a07dfc963417f675 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Sun, 20 Jan 2019 17:45:26 +0100 Subject: [PATCH] be able to normalize at construction --- coeffs.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coeffs.hh b/coeffs.hh index 403c9bc..a9bccd6 100644 --- a/coeffs.hh +++ b/coeffs.hh @@ -8,7 +8,7 @@ Copyright 2018 Ahmet Inan namespace DSP { -template +template class Coeffs { TYPE w[TAPS]; @@ -18,12 +18,16 @@ public: { for (int n = 0; n < TAPS; ++n) w[n] = (*func)(n, TAPS); + if (NORMALIZE) + normalize(); } template Coeffs(FUNC0 *func0, FUNC1 *func1) { for (int n = 0; n < TAPS; ++n) w[n] = (*func0)(n, TAPS) * (*func1)(n, TAPS); + if (NORMALIZE) + normalize(); } void normalize(TYPE divisor = 1) {