aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alFilter.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alFilter.c')
-rw-r--r--OpenAL32/alFilter.c50
1 files changed, 14 insertions, 36 deletions
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index 70595aa0..ade41f4c 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -349,44 +349,22 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g
switch(type)
{
case ALfilterType_HighShelf:
- alpha = sinf(w0) / 2.0f * sqrtf((gain + 1.0f/gain) *
- (1.0f/0.75f - 1.0f) + 2.0f);
- filter->b[0] = gain * ((gain + 1.0f) +
- (gain - 1.0f) * cosf(w0) +
- 2.0f * sqrtf(gain) * alpha);
- filter->b[1] = -2.0f * gain * ((gain - 1.0f) +
- (gain + 1.0f) * cosf(w0));
- filter->b[2] = gain * ((gain + 1.0f) +
- (gain - 1.0f) * cosf(w0) -
- 2.0f * sqrtf(gain) * alpha);
- filter->a[0] = (gain + 1.0f) -
- (gain - 1.0f) * cosf(w0) +
- 2.0f * sqrtf(gain) * alpha;
- filter->a[1] = 2.0f * ((gain - 1.0f) -
- (gain + 1.0f) * cosf(w0));
- filter->a[2] = (gain + 1.0f) -
- (gain - 1.0f) * cosf(w0) -
- 2.0f * sqrtf(gain) * alpha;
+ alpha = sinf(w0)/2.0f*sqrtf((gain + 1.0f/gain)*(1.0f/0.75f - 1.0f) + 2.0f);
+ filter->b[0] = gain*((gain+1.0f) + (gain-1.0f)*cosf(w0) + 2.0f*sqrtf(gain)*alpha);
+ filter->b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cosf(w0) );
+ filter->b[2] = gain*((gain+1.0f) + (gain-1.0f)*cosf(w0) - 2.0f*sqrtf(gain)*alpha);
+ filter->a[0] = (gain+1.0f) - (gain-1.0f)*cosf(w0) + 2.0f*sqrtf(gain)*alpha;
+ filter->a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cosf(w0) );
+ filter->a[2] = (gain+1.0f) - (gain-1.0f)*cosf(w0) - 2.0f*sqrtf(gain)*alpha;
break;
case ALfilterType_LowShelf:
- alpha = sinf(w0) / 2.0f * sqrtf((gain + 1.0f / gain) *
- (1.0f / 0.75f - 1.0f) + 2.0f);
- filter->b[0] = gain * ((gain + 1.0f) -
- (gain - 1.0f) * cosf(w0) +
- 2.0f * sqrtf(gain) * alpha);
- filter->b[1] = 2.0f * gain * ((gain - 1.0f) -
- (gain + 1.0f) * cosf(w0));
- filter->b[2] = gain * ((gain + 1.0f) -
- (gain - 1.0f) * cosf(w0) -
- 2.0f * sqrtf(gain) * alpha);
- filter->a[0] = (gain + 1.0f) +
- (gain - 1.0f) * cosf(w0) +
- 2.0f * sqrtf(gain) * alpha;
- filter->a[1] = -2.0f * ((gain - 1.0f) +
- (gain + 1.0f) * cosf(w0));
- filter->a[2] = (gain + 1.0f) +
- (gain - 1.0f) * cosf(w0) -
- 2.0f * sqrtf(gain) * alpha;
+ alpha = sinf(w0)/2.0f*sqrtf((gain + 1.0f/gain)*(1.0f/0.75f - 1.0f) + 2.0f);
+ filter->b[0] = gain*((gain+1.0f) - (gain-1.0f)*cosf(w0) + 2.0f*sqrtf(gain)*alpha);
+ filter->b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cosf(w0) );
+ filter->b[2] = gain*((gain+1.0f) - (gain-1.0f)*cosf(w0) - 2.0f*sqrtf(gain)*alpha);
+ filter->a[0] = (gain+1.0f) + (gain-1.0f)*cosf(w0) + 2.0f*sqrtf(gain)*alpha;
+ filter->a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cosf(w0) );
+ filter->a[2] = (gain+1.0f) + (gain-1.0f)*cosf(w0) - 2.0f*sqrtf(gain)*alpha;
break;
case ALfilterType_Peaking:
alpha = sinf(w0) * sinhf(logf(2.0f) / 2.0f * bandwidth * w0 / sinf(w0));