mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
made methods const
This commit is contained in:
parent
0427f29ce5
commit
d7acee8494
2 changed files with 13 additions and 13 deletions
12
filter.hh
12
filter.hh
|
|
@ -18,7 +18,7 @@ class LowPass
|
|||
TYPE f;
|
||||
public:
|
||||
LowPass(TYPE cutoff) : f(TYPE(2) * cutoff) {}
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
|
||||
return f * sinc(f * x);
|
||||
|
|
@ -32,7 +32,7 @@ class LowPass2
|
|||
TYPE fac;
|
||||
public:
|
||||
LowPass2(int num, int den) : num(num), den(den), fac(TYPE(2*num)/TYPE(den)) {}
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
int twox = 2 * n - (N - 1);
|
||||
return !twox ? fac : fac *
|
||||
|
|
@ -47,7 +47,7 @@ class HighPass
|
|||
TYPE f;
|
||||
public:
|
||||
HighPass(TYPE cutoff) : f(TYPE(2) * cutoff) {}
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
|
||||
// if (N%1) return delta(x) - f * sinc(f * x);
|
||||
|
|
@ -63,7 +63,7 @@ class HighPass2
|
|||
TYPE fac;
|
||||
public:
|
||||
HighPass2(int num, int den) : num(num), den(den), fac(TYPE(2*num)/TYPE(den)) {}
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
int twox = 2 * n - (N - 1);
|
||||
return !twox ? TYPE(1) - fac :
|
||||
|
|
@ -80,7 +80,7 @@ class BandPass
|
|||
public:
|
||||
BandPass(TYPE cutoff0, TYPE cutoff1) :
|
||||
f0(TYPE(2) * cutoff0), f1(TYPE(2) * cutoff1) {}
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
|
||||
return f1 * sinc(f1 * x) - f0 * sinc(f0 * x);
|
||||
|
|
@ -90,7 +90,7 @@ public:
|
|||
template <typename TYPE>
|
||||
struct HilbertTransform
|
||||
{
|
||||
TYPE operator () (int n, int N)
|
||||
TYPE operator () (int n, int N) const
|
||||
{
|
||||
if (N&1) {
|
||||
int x = n - (N - 1) / 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue