2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2007 by authors.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
32 extern inline struct ALfilter
*LookupFilter(ALCdevice
*device
, ALuint id
);
33 extern inline struct ALfilter
*RemoveFilter(ALCdevice
*device
, ALuint id
);
34 extern inline ALfloat
ALfilterState_processSingle(ALfilterState
*filter
, ALfloat sample
);
36 static void InitFilterParams(ALfilter
*filter
, ALenum type
);
39 AL_API ALvoid AL_APIENTRY
alGenFilters(ALsizei n
, ALuint
*filters
)
46 context
= GetContextRef();
50 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
52 device
= context
->Device
;
53 for(cur
= 0;cur
< n
;cur
++)
55 ALfilter
*filter
= calloc(1, sizeof(ALfilter
));
58 alDeleteFilters(cur
, filters
);
59 SET_ERROR_AND_GOTO(context
, AL_OUT_OF_MEMORY
, done
);
61 InitFilterParams(filter
, AL_FILTER_NULL
);
63 err
= NewThunkEntry(&filter
->id
);
64 if(err
== AL_NO_ERROR
)
65 err
= InsertUIntMapEntry(&device
->FilterMap
, filter
->id
, filter
);
66 if(err
!= AL_NO_ERROR
)
68 FreeThunkEntry(filter
->id
);
69 memset(filter
, 0, sizeof(ALfilter
));
72 alDeleteFilters(cur
, filters
);
73 SET_ERROR_AND_GOTO(context
, err
, done
);
76 filters
[cur
] = filter
->id
;
80 ALCcontext_DecRef(context
);
83 AL_API ALvoid AL_APIENTRY
alDeleteFilters(ALsizei n
, const ALuint
*filters
)
90 context
= GetContextRef();
94 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
96 device
= context
->Device
;
99 if(filters
[i
] && LookupFilter(device
, filters
[i
]) == NULL
)
100 SET_ERROR_AND_GOTO(context
, AL_INVALID_NAME
, done
);
104 if((filter
=RemoveFilter(device
, filters
[i
])) == NULL
)
106 FreeThunkEntry(filter
->id
);
108 memset(filter
, 0, sizeof(*filter
));
113 ALCcontext_DecRef(context
);
116 AL_API ALboolean AL_APIENTRY
alIsFilter(ALuint filter
)
121 Context
= GetContextRef();
122 if(!Context
) return AL_FALSE
;
124 result
= ((!filter
|| LookupFilter(Context
->Device
, filter
)) ?
127 ALCcontext_DecRef(Context
);
132 AL_API ALvoid AL_APIENTRY
alFilteri(ALuint filter
, ALenum param
, ALint value
)
138 Context
= GetContextRef();
141 Device
= Context
->Device
;
142 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
143 alSetError(Context
, AL_INVALID_NAME
);
146 if(param
== AL_FILTER_TYPE
)
148 if(value
== AL_FILTER_NULL
|| value
== AL_FILTER_LOWPASS
||
149 value
== AL_FILTER_HIGHPASS
|| value
== AL_FILTER_BANDPASS
)
150 InitFilterParams(ALFilter
, value
);
152 alSetError(Context
, AL_INVALID_VALUE
);
156 /* Call the appropriate handler */
157 ALfilter_SetParami(ALFilter
, Context
, param
, value
);
161 ALCcontext_DecRef(Context
);
164 AL_API ALvoid AL_APIENTRY
alFilteriv(ALuint filter
, ALenum param
, const ALint
*values
)
173 alFilteri(filter
, param
, values
[0]);
177 Context
= GetContextRef();
180 Device
= Context
->Device
;
181 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
182 alSetError(Context
, AL_INVALID_NAME
);
185 /* Call the appropriate handler */
186 ALfilter_SetParamiv(ALFilter
, Context
, param
, values
);
189 ALCcontext_DecRef(Context
);
192 AL_API ALvoid AL_APIENTRY
alFilterf(ALuint filter
, ALenum param
, ALfloat value
)
198 Context
= GetContextRef();
201 Device
= Context
->Device
;
202 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
203 alSetError(Context
, AL_INVALID_NAME
);
206 /* Call the appropriate handler */
207 ALfilter_SetParamf(ALFilter
, Context
, param
, value
);
210 ALCcontext_DecRef(Context
);
213 AL_API ALvoid AL_APIENTRY
alFilterfv(ALuint filter
, ALenum param
, const ALfloat
*values
)
219 Context
= GetContextRef();
222 Device
= Context
->Device
;
223 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
224 alSetError(Context
, AL_INVALID_NAME
);
227 /* Call the appropriate handler */
228 ALfilter_SetParamfv(ALFilter
, Context
, param
, values
);
231 ALCcontext_DecRef(Context
);
234 AL_API ALvoid AL_APIENTRY
alGetFilteri(ALuint filter
, ALenum param
, ALint
*value
)
240 Context
= GetContextRef();
243 Device
= Context
->Device
;
244 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
245 alSetError(Context
, AL_INVALID_NAME
);
248 if(param
== AL_FILTER_TYPE
)
249 *value
= ALFilter
->type
;
252 /* Call the appropriate handler */
253 ALfilter_GetParami(ALFilter
, Context
, param
, value
);
257 ALCcontext_DecRef(Context
);
260 AL_API ALvoid AL_APIENTRY
alGetFilteriv(ALuint filter
, ALenum param
, ALint
*values
)
269 alGetFilteri(filter
, param
, values
);
273 Context
= GetContextRef();
276 Device
= Context
->Device
;
277 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
278 alSetError(Context
, AL_INVALID_NAME
);
281 /* Call the appropriate handler */
282 ALfilter_GetParamiv(ALFilter
, Context
, param
, values
);
285 ALCcontext_DecRef(Context
);
288 AL_API ALvoid AL_APIENTRY
alGetFilterf(ALuint filter
, ALenum param
, ALfloat
*value
)
294 Context
= GetContextRef();
297 Device
= Context
->Device
;
298 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
299 alSetError(Context
, AL_INVALID_NAME
);
302 /* Call the appropriate handler */
303 ALfilter_GetParamf(ALFilter
, Context
, param
, value
);
306 ALCcontext_DecRef(Context
);
309 AL_API ALvoid AL_APIENTRY
alGetFilterfv(ALuint filter
, ALenum param
, ALfloat
*values
)
315 Context
= GetContextRef();
318 Device
= Context
->Device
;
319 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
320 alSetError(Context
, AL_INVALID_NAME
);
323 /* Call the appropriate handler */
324 ALfilter_GetParamfv(ALFilter
, Context
, param
, values
);
327 ALCcontext_DecRef(Context
);
331 void ALfilterState_clear(ALfilterState
*filter
)
339 void ALfilterState_setParams(ALfilterState
*filter
, ALfilterType type
, ALfloat gain
, ALfloat freq_mult
, ALfloat bandwidth
)
344 // Limit gain to -100dB
345 gain
= maxf(gain
, 0.00001f
);
347 w0
= F_2PI
* freq_mult
;
349 /* Calculate filter coefficients depending on filter type */
352 case ALfilterType_HighShelf
:
353 alpha
= sinf(w0
)/2.0f
*sqrtf((gain
+ 1.0f
/gain
)*(1.0f
/0.75f
- 1.0f
) + 2.0f
);
354 filter
->b
[0] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cosf(w0
) + 2.0f
*sqrtf(gain
)*alpha
);
355 filter
->b
[1] = -2.0f
*gain
*((gain
-1.0f
) + (gain
+1.0f
)*cosf(w0
) );
356 filter
->b
[2] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cosf(w0
) - 2.0f
*sqrtf(gain
)*alpha
);
357 filter
->a
[0] = (gain
+1.0f
) - (gain
-1.0f
)*cosf(w0
) + 2.0f
*sqrtf(gain
)*alpha
;
358 filter
->a
[1] = 2.0f
* ((gain
-1.0f
) - (gain
+1.0f
)*cosf(w0
) );
359 filter
->a
[2] = (gain
+1.0f
) - (gain
-1.0f
)*cosf(w0
) - 2.0f
*sqrtf(gain
)*alpha
;
361 case ALfilterType_LowShelf
:
362 alpha
= sinf(w0
)/2.0f
*sqrtf((gain
+ 1.0f
/gain
)*(1.0f
/0.75f
- 1.0f
) + 2.0f
);
363 filter
->b
[0] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cosf(w0
) + 2.0f
*sqrtf(gain
)*alpha
);
364 filter
->b
[1] = 2.0f
*gain
*((gain
-1.0f
) - (gain
+1.0f
)*cosf(w0
) );
365 filter
->b
[2] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cosf(w0
) - 2.0f
*sqrtf(gain
)*alpha
);
366 filter
->a
[0] = (gain
+1.0f
) + (gain
-1.0f
)*cosf(w0
) + 2.0f
*sqrtf(gain
)*alpha
;
367 filter
->a
[1] = -2.0f
* ((gain
-1.0f
) + (gain
+1.0f
)*cosf(w0
) );
368 filter
->a
[2] = (gain
+1.0f
) + (gain
-1.0f
)*cosf(w0
) - 2.0f
*sqrtf(gain
)*alpha
;
370 case ALfilterType_Peaking
:
371 alpha
= sinf(w0
) * sinhf(logf(2.0f
) / 2.0f
* bandwidth
* w0
/ sinf(w0
));
372 filter
->b
[0] = 1.0f
+ alpha
* gain
;
373 filter
->b
[1] = -2.0f
* cosf(w0
);
374 filter
->b
[2] = 1.0f
- alpha
* gain
;
375 filter
->a
[0] = 1.0f
+ alpha
/ gain
;
376 filter
->a
[1] = -2.0f
* cosf(w0
);
377 filter
->a
[2] = 1.0f
- alpha
/ gain
;
380 case ALfilterType_LowPass
:
381 alpha
= sinf(w0
) * sinhf(logf(2.0f
) / 2.0f
* bandwidth
* w0
/ sinf(w0
));
382 filter
->b
[0] = (1.0f
- cosf(w0
)) / 2.0f
;
383 filter
->b
[1] = 1.0f
- cosf(w0
);
384 filter
->b
[2] = (1.0f
- cosf(w0
)) / 2.0f
;
385 filter
->a
[0] = 1.0f
+ alpha
;
386 filter
->a
[1] = -2.0f
* cosf(w0
);
387 filter
->a
[2] = 1.0f
- alpha
;
389 case ALfilterType_HighPass
:
390 alpha
= sinf(w0
) * sinhf(logf(2.0f
) / 2.0f
* bandwidth
* w0
/ sinf(w0
));
391 filter
->b
[0] = (1.0f
+ cosf(w0
)) / 2.0f
;
392 filter
->b
[1] = 1.0f
+ cosf(w0
);
393 filter
->b
[2] = (1.0f
+ cosf(w0
)) / 2.0f
;
394 filter
->a
[0] = 1.0f
+ alpha
;
395 filter
->a
[1] = -2.0f
* cosf(w0
);
396 filter
->a
[2] = 1.0f
- alpha
;
398 case ALfilterType_BandPass
:
399 alpha
= sinf(w0
) * sinhf(logf(2.0f
) / 2.0f
* bandwidth
* w0
/ sinf(w0
));
400 filter
->b
[0] = alpha
;
402 filter
->b
[2] = -alpha
;
403 filter
->a
[0] = 1.0f
+ alpha
;
404 filter
->a
[1] = -2.0f
* cosf(w0
);
405 filter
->a
[2] = 1.0f
- alpha
;
409 filter
->b
[2] /= filter
->a
[0];
410 filter
->b
[1] /= filter
->a
[0];
411 filter
->b
[0] /= filter
->a
[0];
412 filter
->a
[2] /= filter
->a
[0];
413 filter
->a
[1] /= filter
->a
[0];
414 filter
->a
[0] /= filter
->a
[0];
416 filter
->process
= ALfilterState_processC
;
420 static void lp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
421 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
422 static void lp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
423 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
424 static void lp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
428 case AL_LOWPASS_GAIN
:
429 if(!(val
>= AL_LOWPASS_MIN_GAIN
&& val
<= AL_LOWPASS_MAX_GAIN
))
430 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
434 case AL_LOWPASS_GAINHF
:
435 if(!(val
>= AL_LOWPASS_MIN_GAINHF
&& val
<= AL_LOWPASS_MAX_GAINHF
))
436 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
437 filter
->GainHF
= val
;
441 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
444 static void lp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
446 lp_SetParamf(filter
, context
, param
, vals
[0]);
449 static void lp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
450 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
451 static void lp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
452 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
453 static void lp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
457 case AL_LOWPASS_GAIN
:
461 case AL_LOWPASS_GAINHF
:
462 *val
= filter
->GainHF
;
466 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
469 static void lp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
471 lp_GetParamf(filter
, context
, param
, vals
);
475 static void hp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
476 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
477 static void hp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
478 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
479 static void hp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
483 case AL_HIGHPASS_GAIN
:
484 if(!(val
>= AL_HIGHPASS_MIN_GAIN
&& val
<= AL_HIGHPASS_MAX_GAIN
))
485 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
489 case AL_HIGHPASS_GAINLF
:
490 if(!(val
>= AL_HIGHPASS_MIN_GAINLF
&& val
<= AL_HIGHPASS_MAX_GAINLF
))
491 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
492 filter
->GainLF
= val
;
496 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
499 static void hp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
501 hp_SetParamf(filter
, context
, param
, vals
[0]);
504 static void hp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
505 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
506 static void hp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
507 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
508 static void hp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
512 case AL_HIGHPASS_GAIN
:
516 case AL_HIGHPASS_GAINLF
:
517 *val
= filter
->GainLF
;
521 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
524 static void hp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
526 hp_GetParamf(filter
, context
, param
, vals
);
530 static void bp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
531 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
532 static void bp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
533 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
534 static void bp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
538 case AL_BANDPASS_GAIN
:
539 if(!(val
>= AL_BANDPASS_MIN_GAIN
&& val
<= AL_BANDPASS_MAX_GAIN
))
540 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
544 case AL_BANDPASS_GAINHF
:
545 if(!(val
>= AL_BANDPASS_MIN_GAINHF
&& val
<= AL_BANDPASS_MAX_GAINHF
))
546 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
547 filter
->GainHF
= val
;
550 case AL_BANDPASS_GAINLF
:
551 if(!(val
>= AL_BANDPASS_MIN_GAINLF
&& val
<= AL_BANDPASS_MAX_GAINLF
))
552 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
553 filter
->GainLF
= val
;
557 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
560 static void bp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
562 bp_SetParamf(filter
, context
, param
, vals
[0]);
565 static void bp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
566 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
567 static void bp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
568 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
569 static void bp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
573 case AL_BANDPASS_GAIN
:
577 case AL_BANDPASS_GAINHF
:
578 *val
= filter
->GainHF
;
581 case AL_BANDPASS_GAINLF
:
582 *val
= filter
->GainLF
;
586 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
589 static void bp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
591 bp_GetParamf(filter
, context
, param
, vals
);
595 static void null_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
596 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
597 static void null_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
598 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
599 static void null_SetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
UNUSED(val
))
600 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
601 static void null_SetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALfloat
*UNUSED(vals
))
602 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
604 static void null_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
605 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
606 static void null_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
607 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
608 static void null_GetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(val
))
609 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
610 static void null_GetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(vals
))
611 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
614 ALvoid
ReleaseALFilters(ALCdevice
*device
)
617 for(i
= 0;i
< device
->FilterMap
.size
;i
++)
619 ALfilter
*temp
= device
->FilterMap
.array
[i
].value
;
620 device
->FilterMap
.array
[i
].value
= NULL
;
622 // Release filter structure
623 FreeThunkEntry(temp
->id
);
624 memset(temp
, 0, sizeof(ALfilter
));
630 static void InitFilterParams(ALfilter
*filter
, ALenum type
)
632 if(type
== AL_FILTER_LOWPASS
)
634 filter
->Gain
= AL_LOWPASS_DEFAULT_GAIN
;
635 filter
->GainHF
= AL_LOWPASS_DEFAULT_GAINHF
;
636 filter
->HFReference
= LOWPASSFREQREF
;
637 filter
->GainLF
= 1.0f
;
638 filter
->LFReference
= HIGHPASSFREQREF
;
640 filter
->SetParami
= lp_SetParami
;
641 filter
->SetParamiv
= lp_SetParamiv
;
642 filter
->SetParamf
= lp_SetParamf
;
643 filter
->SetParamfv
= lp_SetParamfv
;
644 filter
->GetParami
= lp_GetParami
;
645 filter
->GetParamiv
= lp_GetParamiv
;
646 filter
->GetParamf
= lp_GetParamf
;
647 filter
->GetParamfv
= lp_GetParamfv
;
649 else if(type
== AL_FILTER_HIGHPASS
)
651 filter
->Gain
= AL_HIGHPASS_DEFAULT_GAIN
;
652 filter
->GainHF
= 1.0f
;
653 filter
->HFReference
= LOWPASSFREQREF
;
654 filter
->GainLF
= AL_HIGHPASS_DEFAULT_GAINLF
;
655 filter
->LFReference
= HIGHPASSFREQREF
;
657 filter
->SetParami
= hp_SetParami
;
658 filter
->SetParamiv
= hp_SetParamiv
;
659 filter
->SetParamf
= hp_SetParamf
;
660 filter
->SetParamfv
= hp_SetParamfv
;
661 filter
->GetParami
= hp_GetParami
;
662 filter
->GetParamiv
= hp_GetParamiv
;
663 filter
->GetParamf
= hp_GetParamf
;
664 filter
->GetParamfv
= hp_GetParamfv
;
666 else if(type
== AL_FILTER_BANDPASS
)
668 filter
->Gain
= AL_BANDPASS_DEFAULT_GAIN
;
669 filter
->GainHF
= AL_BANDPASS_DEFAULT_GAINHF
;
670 filter
->HFReference
= LOWPASSFREQREF
;
671 filter
->GainLF
= AL_BANDPASS_DEFAULT_GAINLF
;
672 filter
->LFReference
= HIGHPASSFREQREF
;
674 filter
->SetParami
= bp_SetParami
;
675 filter
->SetParamiv
= bp_SetParamiv
;
676 filter
->SetParamf
= bp_SetParamf
;
677 filter
->SetParamfv
= bp_SetParamfv
;
678 filter
->GetParami
= bp_GetParami
;
679 filter
->GetParamiv
= bp_GetParamiv
;
680 filter
->GetParamf
= bp_GetParamf
;
681 filter
->GetParamfv
= bp_GetParamfv
;
686 filter
->GainHF
= 1.0f
;
687 filter
->HFReference
= LOWPASSFREQREF
;
688 filter
->GainLF
= 1.0f
;
689 filter
->LFReference
= HIGHPASSFREQREF
;
691 filter
->SetParami
= null_SetParami
;
692 filter
->SetParamiv
= null_SetParamiv
;
693 filter
->SetParamf
= null_SetParamf
;
694 filter
->SetParamfv
= null_SetParamfv
;
695 filter
->GetParami
= null_GetParami
;
696 filter
->GetParamiv
= null_GetParamiv
;
697 filter
->GetParamf
= null_GetParamf
;
698 filter
->GetParamfv
= null_GetParamfv
;