mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added a divisor argument with default 1 to normalize()
This commit is contained in:
parent
4332041e3e
commit
6120bb163f
1 changed files with 2 additions and 2 deletions
|
|
@ -28,13 +28,13 @@ public:
|
|||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] = (*func)(n, TAPS);
|
||||
}
|
||||
void normalize()
|
||||
void normalize(TYPE divisor = 1)
|
||||
{
|
||||
TYPE sum(0);
|
||||
for (int n = 0; n < TAPS; ++n)
|
||||
sum += w[n];
|
||||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] /= std::abs(sum);
|
||||
w[n] /= divisor * std::abs(sum);
|
||||
}
|
||||
inline TYPE operator () (int n) { return n >= 0 && n < TAPS ? w[n] : 0; }
|
||||
inline operator const TYPE * () const { return w; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue