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.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
);
35 extern inline ALfloat
calc_rcpQ_from_slope(ALfloat gain
, ALfloat slope
);
36 extern inline ALfloat
calc_rcpQ_from_bandwidth(ALfloat freq_mult
, ALfloat bandwidth
);
38 static void InitFilterParams(ALfilter
*filter
, ALenum type
);
41 AL_API ALvoid AL_APIENTRY
alGenFilters(ALsizei n
, ALuint
*filters
)
48 context
= GetContextRef();
52 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
54 device
= context
->Device
;
55 for(cur
= 0;cur
< n
;cur
++)
57 ALfilter
*filter
= calloc(1, sizeof(ALfilter
));
60 alDeleteFilters(cur
, filters
);
61 SET_ERROR_AND_GOTO(context
, AL_OUT_OF_MEMORY
, done
);
63 InitFilterParams(filter
, AL_FILTER_NULL
);
65 err
= NewThunkEntry(&filter
->id
);
66 if(err
== AL_NO_ERROR
)
67 err
= InsertUIntMapEntry(&device
->FilterMap
, filter
->id
, filter
);
68 if(err
!= AL_NO_ERROR
)
70 FreeThunkEntry(filter
->id
);
71 memset(filter
, 0, sizeof(ALfilter
));
74 alDeleteFilters(cur
, filters
);
75 SET_ERROR_AND_GOTO(context
, err
, done
);
78 filters
[cur
] = filter
->id
;
82 ALCcontext_DecRef(context
);
85 AL_API ALvoid AL_APIENTRY
alDeleteFilters(ALsizei n
, const ALuint
*filters
)
92 context
= GetContextRef();
96 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
98 device
= context
->Device
;
101 if(filters
[i
] && LookupFilter(device
, filters
[i
]) == NULL
)
102 SET_ERROR_AND_GOTO(context
, AL_INVALID_NAME
, done
);
106 if((filter
=RemoveFilter(device
, filters
[i
])) == NULL
)
108 FreeThunkEntry(filter
->id
);
110 memset(filter
, 0, sizeof(*filter
));
115 ALCcontext_DecRef(context
);
118 AL_API ALboolean AL_APIENTRY
alIsFilter(ALuint filter
)
123 Context
= GetContextRef();
124 if(!Context
) return AL_FALSE
;
126 result
= ((!filter
|| LookupFilter(Context
->Device
, filter
)) ?
129 ALCcontext_DecRef(Context
);
134 AL_API ALvoid AL_APIENTRY
alFilteri(ALuint filter
, ALenum param
, ALint value
)
140 Context
= GetContextRef();
143 Device
= Context
->Device
;
144 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
145 alSetError(Context
, AL_INVALID_NAME
);
148 if(param
== AL_FILTER_TYPE
)
150 if(value
== AL_FILTER_NULL
|| value
== AL_FILTER_LOWPASS
||
151 value
== AL_FILTER_HIGHPASS
|| value
== AL_FILTER_BANDPASS
)
152 InitFilterParams(ALFilter
, value
);
154 alSetError(Context
, AL_INVALID_VALUE
);
158 /* Call the appropriate handler */
159 ALfilter_SetParami(ALFilter
, Context
, param
, value
);
163 ALCcontext_DecRef(Context
);
166 AL_API ALvoid AL_APIENTRY
alFilteriv(ALuint filter
, ALenum param
, const ALint
*values
)
175 alFilteri(filter
, param
, values
[0]);
179 Context
= GetContextRef();
182 Device
= Context
->Device
;
183 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
184 alSetError(Context
, AL_INVALID_NAME
);
187 /* Call the appropriate handler */
188 ALfilter_SetParamiv(ALFilter
, Context
, param
, values
);
191 ALCcontext_DecRef(Context
);
194 AL_API ALvoid AL_APIENTRY
alFilterf(ALuint filter
, ALenum param
, ALfloat value
)
200 Context
= GetContextRef();
203 Device
= Context
->Device
;
204 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
205 alSetError(Context
, AL_INVALID_NAME
);
208 /* Call the appropriate handler */
209 ALfilter_SetParamf(ALFilter
, Context
, param
, value
);
212 ALCcontext_DecRef(Context
);
215 AL_API ALvoid AL_APIENTRY
alFilterfv(ALuint filter
, ALenum param
, const ALfloat
*values
)
221 Context
= GetContextRef();
224 Device
= Context
->Device
;
225 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
226 alSetError(Context
, AL_INVALID_NAME
);
229 /* Call the appropriate handler */
230 ALfilter_SetParamfv(ALFilter
, Context
, param
, values
);
233 ALCcontext_DecRef(Context
);
236 AL_API ALvoid AL_APIENTRY
alGetFilteri(ALuint filter
, ALenum param
, ALint
*value
)
242 Context
= GetContextRef();
245 Device
= Context
->Device
;
246 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
247 alSetError(Context
, AL_INVALID_NAME
);
250 if(param
== AL_FILTER_TYPE
)
251 *value
= ALFilter
->type
;
254 /* Call the appropriate handler */
255 ALfilter_GetParami(ALFilter
, Context
, param
, value
);
259 ALCcontext_DecRef(Context
);
262 AL_API ALvoid AL_APIENTRY
alGetFilteriv(ALuint filter
, ALenum param
, ALint
*values
)
271 alGetFilteri(filter
, param
, values
);
275 Context
= GetContextRef();
278 Device
= Context
->Device
;
279 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
280 alSetError(Context
, AL_INVALID_NAME
);
283 /* Call the appropriate handler */
284 ALfilter_GetParamiv(ALFilter
, Context
, param
, values
);
287 ALCcontext_DecRef(Context
);
290 AL_API ALvoid AL_APIENTRY
alGetFilterf(ALuint filter
, ALenum param
, ALfloat
*value
)
296 Context
= GetContextRef();
299 Device
= Context
->Device
;
300 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
301 alSetError(Context
, AL_INVALID_NAME
);
304 /* Call the appropriate handler */
305 ALfilter_GetParamf(ALFilter
, Context
, param
, value
);
308 ALCcontext_DecRef(Context
);
311 AL_API ALvoid AL_APIENTRY
alGetFilterfv(ALuint filter
, ALenum param
, ALfloat
*values
)
317 Context
= GetContextRef();
320 Device
= Context
->Device
;
321 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
322 alSetError(Context
, AL_INVALID_NAME
);
325 /* Call the appropriate handler */
326 ALfilter_GetParamfv(ALFilter
, Context
, param
, values
);
329 ALCcontext_DecRef(Context
);
333 void ALfilterState_clear(ALfilterState
*filter
)
341 void ALfilterState_setParams(ALfilterState
*filter
, ALfilterType type
, ALfloat gain
, ALfloat freq_mult
, ALfloat rcpQ
)
343 ALfloat alpha
, sqrtgain_alpha_2
;
344 ALfloat w0
, sin_w0
, cos_w0
;
346 // Limit gain to -100dB
347 gain
= maxf(gain
, 0.00001f
);
349 w0
= F_TAU
* freq_mult
;
352 alpha
= sin_w0
/2.0f
* rcpQ
;
354 /* Calculate filter coefficients depending on filter type */
357 case ALfilterType_HighShelf
:
358 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
359 filter
->b
[0] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
360 filter
->b
[1] = -2.0f
*gain
*((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
361 filter
->b
[2] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
362 filter
->a
[0] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
363 filter
->a
[1] = 2.0f
* ((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
364 filter
->a
[2] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
366 case ALfilterType_LowShelf
:
367 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
368 filter
->b
[0] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
369 filter
->b
[1] = 2.0f
*gain
*((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
370 filter
->b
[2] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
371 filter
->a
[0] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
372 filter
->a
[1] = -2.0f
* ((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
373 filter
->a
[2] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
375 case ALfilterType_Peaking
:
377 filter
->b
[0] = 1.0f
+ alpha
* gain
;
378 filter
->b
[1] = -2.0f
* cos_w0
;
379 filter
->b
[2] = 1.0f
- alpha
* gain
;
380 filter
->a
[0] = 1.0f
+ alpha
/ gain
;
381 filter
->a
[1] = -2.0f
* cos_w0
;
382 filter
->a
[2] = 1.0f
- alpha
/ gain
;
385 case ALfilterType_LowPass
:
386 filter
->b
[0] = (1.0f
- cos_w0
) / 2.0f
;
387 filter
->b
[1] = 1.0f
- cos_w0
;
388 filter
->b
[2] = (1.0f
- cos_w0
) / 2.0f
;
389 filter
->a
[0] = 1.0f
+ alpha
;
390 filter
->a
[1] = -2.0f
* cos_w0
;
391 filter
->a
[2] = 1.0f
- alpha
;
393 case ALfilterType_HighPass
:
394 filter
->b
[0] = (1.0f
+ cos_w0
) / 2.0f
;
395 filter
->b
[1] = -(1.0f
+ cos_w0
);
396 filter
->b
[2] = (1.0f
+ cos_w0
) / 2.0f
;
397 filter
->a
[0] = 1.0f
+ alpha
;
398 filter
->a
[1] = -2.0f
* cos_w0
;
399 filter
->a
[2] = 1.0f
- alpha
;
401 case ALfilterType_BandPass
:
402 filter
->b
[0] = alpha
;
404 filter
->b
[2] = -alpha
;
405 filter
->a
[0] = 1.0f
+ alpha
;
406 filter
->a
[1] = -2.0f
* cos_w0
;
407 filter
->a
[2] = 1.0f
- alpha
;
411 filter
->b
[2] /= filter
->a
[0];
412 filter
->b
[1] /= filter
->a
[0];
413 filter
->b
[0] /= filter
->a
[0];
414 filter
->a
[2] /= filter
->a
[0];
415 filter
->a
[1] /= filter
->a
[0];
416 filter
->a
[0] /= filter
->a
[0];
418 filter
->process
= ALfilterState_processC
;
421 void ALfilterState_processPassthru(ALfilterState
*filter
, const ALfloat
*src
, ALuint numsamples
)
425 filter
->x
[1] = src
[numsamples
-2];
426 filter
->x
[0] = src
[numsamples
-1];
427 filter
->y
[1] = src
[numsamples
-2];
428 filter
->y
[0] = src
[numsamples
-1];
430 else if(numsamples
== 1)
432 filter
->x
[1] = filter
->x
[0];
433 filter
->x
[0] = src
[0];
434 filter
->y
[1] = filter
->y
[0];
435 filter
->y
[0] = src
[0];
440 static void lp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
441 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
442 static void lp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
443 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
444 static void lp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
448 case AL_LOWPASS_GAIN
:
449 if(!(val
>= AL_LOWPASS_MIN_GAIN
&& val
<= AL_LOWPASS_MAX_GAIN
))
450 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
454 case AL_LOWPASS_GAINHF
:
455 if(!(val
>= AL_LOWPASS_MIN_GAINHF
&& val
<= AL_LOWPASS_MAX_GAINHF
))
456 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
457 filter
->GainHF
= val
;
461 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
464 static void lp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
466 lp_SetParamf(filter
, context
, param
, vals
[0]);
469 static void lp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
470 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
471 static void lp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
472 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
473 static void lp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
477 case AL_LOWPASS_GAIN
:
481 case AL_LOWPASS_GAINHF
:
482 *val
= filter
->GainHF
;
486 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
489 static void lp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
491 lp_GetParamf(filter
, context
, param
, vals
);
495 static void hp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
496 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
497 static void hp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
498 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
499 static void hp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
503 case AL_HIGHPASS_GAIN
:
504 if(!(val
>= AL_HIGHPASS_MIN_GAIN
&& val
<= AL_HIGHPASS_MAX_GAIN
))
505 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
509 case AL_HIGHPASS_GAINLF
:
510 if(!(val
>= AL_HIGHPASS_MIN_GAINLF
&& val
<= AL_HIGHPASS_MAX_GAINLF
))
511 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
512 filter
->GainLF
= val
;
516 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
519 static void hp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
521 hp_SetParamf(filter
, context
, param
, vals
[0]);
524 static void hp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
525 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
526 static void hp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
527 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
528 static void hp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
532 case AL_HIGHPASS_GAIN
:
536 case AL_HIGHPASS_GAINLF
:
537 *val
= filter
->GainLF
;
541 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
544 static void hp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
546 hp_GetParamf(filter
, context
, param
, vals
);
550 static void bp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
551 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
552 static void bp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
553 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
554 static void bp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
558 case AL_BANDPASS_GAIN
:
559 if(!(val
>= AL_BANDPASS_MIN_GAIN
&& val
<= AL_BANDPASS_MAX_GAIN
))
560 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
564 case AL_BANDPASS_GAINHF
:
565 if(!(val
>= AL_BANDPASS_MIN_GAINHF
&& val
<= AL_BANDPASS_MAX_GAINHF
))
566 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
567 filter
->GainHF
= val
;
570 case AL_BANDPASS_GAINLF
:
571 if(!(val
>= AL_BANDPASS_MIN_GAINLF
&& val
<= AL_BANDPASS_MAX_GAINLF
))
572 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
573 filter
->GainLF
= val
;
577 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
580 static void bp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
582 bp_SetParamf(filter
, context
, param
, vals
[0]);
585 static void bp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
586 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
587 static void bp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
588 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
589 static void bp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
593 case AL_BANDPASS_GAIN
:
597 case AL_BANDPASS_GAINHF
:
598 *val
= filter
->GainHF
;
601 case AL_BANDPASS_GAINLF
:
602 *val
= filter
->GainLF
;
606 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
609 static void bp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
611 bp_GetParamf(filter
, context
, param
, vals
);
615 static void null_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
616 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
617 static void null_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
618 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
619 static void null_SetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
UNUSED(val
))
620 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
621 static void null_SetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALfloat
*UNUSED(vals
))
622 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
624 static void null_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
625 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
626 static void null_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
627 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
628 static void null_GetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(val
))
629 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
630 static void null_GetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(vals
))
631 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
634 ALvoid
ReleaseALFilters(ALCdevice
*device
)
637 for(i
= 0;i
< device
->FilterMap
.size
;i
++)
639 ALfilter
*temp
= device
->FilterMap
.array
[i
].value
;
640 device
->FilterMap
.array
[i
].value
= NULL
;
642 // Release filter structure
643 FreeThunkEntry(temp
->id
);
644 memset(temp
, 0, sizeof(ALfilter
));
650 static void InitFilterParams(ALfilter
*filter
, ALenum type
)
652 if(type
== AL_FILTER_LOWPASS
)
654 filter
->Gain
= AL_LOWPASS_DEFAULT_GAIN
;
655 filter
->GainHF
= AL_LOWPASS_DEFAULT_GAINHF
;
656 filter
->HFReference
= LOWPASSFREQREF
;
657 filter
->GainLF
= 1.0f
;
658 filter
->LFReference
= HIGHPASSFREQREF
;
660 filter
->SetParami
= lp_SetParami
;
661 filter
->SetParamiv
= lp_SetParamiv
;
662 filter
->SetParamf
= lp_SetParamf
;
663 filter
->SetParamfv
= lp_SetParamfv
;
664 filter
->GetParami
= lp_GetParami
;
665 filter
->GetParamiv
= lp_GetParamiv
;
666 filter
->GetParamf
= lp_GetParamf
;
667 filter
->GetParamfv
= lp_GetParamfv
;
669 else if(type
== AL_FILTER_HIGHPASS
)
671 filter
->Gain
= AL_HIGHPASS_DEFAULT_GAIN
;
672 filter
->GainHF
= 1.0f
;
673 filter
->HFReference
= LOWPASSFREQREF
;
674 filter
->GainLF
= AL_HIGHPASS_DEFAULT_GAINLF
;
675 filter
->LFReference
= HIGHPASSFREQREF
;
677 filter
->SetParami
= hp_SetParami
;
678 filter
->SetParamiv
= hp_SetParamiv
;
679 filter
->SetParamf
= hp_SetParamf
;
680 filter
->SetParamfv
= hp_SetParamfv
;
681 filter
->GetParami
= hp_GetParami
;
682 filter
->GetParamiv
= hp_GetParamiv
;
683 filter
->GetParamf
= hp_GetParamf
;
684 filter
->GetParamfv
= hp_GetParamfv
;
686 else if(type
== AL_FILTER_BANDPASS
)
688 filter
->Gain
= AL_BANDPASS_DEFAULT_GAIN
;
689 filter
->GainHF
= AL_BANDPASS_DEFAULT_GAINHF
;
690 filter
->HFReference
= LOWPASSFREQREF
;
691 filter
->GainLF
= AL_BANDPASS_DEFAULT_GAINLF
;
692 filter
->LFReference
= HIGHPASSFREQREF
;
694 filter
->SetParami
= bp_SetParami
;
695 filter
->SetParamiv
= bp_SetParamiv
;
696 filter
->SetParamf
= bp_SetParamf
;
697 filter
->SetParamfv
= bp_SetParamfv
;
698 filter
->GetParami
= bp_GetParami
;
699 filter
->GetParamiv
= bp_GetParamiv
;
700 filter
->GetParamf
= bp_GetParamf
;
701 filter
->GetParamfv
= bp_GetParamfv
;
706 filter
->GainHF
= 1.0f
;
707 filter
->HFReference
= LOWPASSFREQREF
;
708 filter
->GainLF
= 1.0f
;
709 filter
->LFReference
= HIGHPASSFREQREF
;
711 filter
->SetParami
= null_SetParami
;
712 filter
->SetParamiv
= null_SetParamiv
;
713 filter
->SetParamf
= null_SetParamf
;
714 filter
->SetParamfv
= null_SetParamfv
;
715 filter
->GetParami
= null_GetParami
;
716 filter
->GetParamiv
= null_GetParamiv
;
717 filter
->GetParamf
= null_GetParamf
;
718 filter
->GetParamfv
= null_GetParamfv
;