mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 22:35:45 +00:00
added normalize() to Taps
This commit is contained in:
parent
375d8dea41
commit
baa8d42a19
1 changed files with 8 additions and 0 deletions
|
|
@ -28,6 +28,14 @@ public:
|
|||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] = (*func)(n, TAPS);
|
||||
}
|
||||
void normalize()
|
||||
{
|
||||
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);
|
||||
}
|
||||
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