76 const unsigned int N = win.
getSize() - 1;
77 const float oneOverN = 1.0 / N;
79 for(
unsigned int n = 0; n <= N; ++n){
80 const float K = (2.0 * n * oneOverN) - 1.0;
81 const float arg = sqrtf( 1.0 - (K * K) );
106 const unsigned int N = win.
getSize() - 1;
107 const float oneOverN = 1.0 / N;
110 win[0] = win[N] = 0.0;
112 for(
unsigned int n = 1; n < N; ++n){
113 const float K = (2.0 * n * oneOverN) - 1.0;
114 const float arg = sqrtf( 1.0 - (K * K) );
128 const float eps = 0.000001;
131 float besselValue = 0;
136 while(term > eps * besselValue){
141 term *= (x*x) / (4*m*m);
155 const float eps = 0.000001;
158 float besselValue = 0;
163 while(term > eps * besselValue)
169 term *= (x*x) / (4*m*(m+1));
183 ASSERT(atten >= 0,
"Kaiser window shape must be > 0dB");
186 alpha = 0.12438 * (atten + 6.3);
187 }
else if(atten > 13.26){
188 alpha = 0.76609L * ( powf((atten - 13.26), 0.4) ) +
189 0.09834L * (atten - 13.26L);
214 return long(1.0 + (2. * sqrtf((
M_PI*
M_PI) + (alpha*alpha)) / (
M_PI * width)) );
This class contains useful methods for manipulating arrays of floats.
static void destroy(FloatArray array)
Destroys a FloatArray created with the create() method.
static void destroy(KaiserWindow obj)
static void buildWindow(FloatArray win, float shape)
Build a new Kaiser analysis window having the specified shaping parameter.
static float firstOrderBessel(float x)
static float computeShape(float atten)
static void buildTimeDerivativeWindow(FloatArray win, float shape)
Build a new time-derivative Kaiser analysis window having the specified shaping parameter,...
static size_t computeLength(float width, float alpha)
KaiserWindow(float *data, size_t size)
static KaiserWindow create(float shape, size_t size, bool derivative=false)
static float zeroethOrderBessel(float x)
T * getData()
Get the data stored in the Array.
#define ASSERT(cond, msg)