30 #define M_PI 3.14159265358979323846 34 return (fabs(x) < 1e-10) ? 1.0 : (
sin(
M_PI * x) / (
M_PI * x));
39 return (fabs(x) < 1e-10) ? 0.0 : ((1.0 -
cos(
M_PI * x)) / (
M_PI * x));
44 return (x < min) ?
min : ((x >
max) ? max : x);
48 inline float decayavg(
float average,
float input,
int weight)
50 if (weight <= 1)
return input;
51 return ( ( input - average ) / (
float)weight ) + average ;
57 return (0.42 - 0.50 *
cos(2 *
M_PI * x) + 0.08 *
cos(4 *
M_PI * x));
62 return 0.54 - 0.46 *
cos(2 *
M_PI * x);
67 return 0.5 - 0.5 *
cos(2 *
M_PI * x);
70 inline float rcos(
float t,
float T,
float alpha=1.0 )
72 if( t == 0 )
return 1.0;
73 float taT = T / (2.0 * alpha);
74 if( fabs(t) == taT )
return ((alpha/2.0) *
sin(
M_PI/(2.0*alpha)));
float decayavg(float average, float input, int weight)
This is always called with an int weight.
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
float clamp(float x, float min, float max)
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
float rcos(float t, float T, float alpha=1.0)
T max(const T &x, const T &y)
T min(const T &x, const T &y)