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 void LockFiltersRead(ALCdevice
*device
);
33 extern inline void UnlockFiltersRead(ALCdevice
*device
);
34 extern inline void LockFiltersWrite(ALCdevice
*device
);
35 extern inline void UnlockFiltersWrite(ALCdevice
*device
);
36 extern inline struct ALfilter
*LookupFilter(ALCdevice
*device
, ALuint id
);
37 extern inline struct ALfilter
*RemoveFilter(ALCdevice
*device
, ALuint id
);
38 extern inline void ALfilterState_clear(ALfilterState
*filter
);
39 extern inline void ALfilterState_processPassthru(ALfilterState
*filter
, const ALfloat
*restrict src
, ALsizei numsamples
);
40 extern inline ALfloat
calc_rcpQ_from_slope(ALfloat gain
, ALfloat slope
);
41 extern inline ALfloat
calc_rcpQ_from_bandwidth(ALfloat freq_mult
, ALfloat bandwidth
);
43 static void InitFilterParams(ALfilter
*filter
, ALenum type
);
46 AL_API ALvoid AL_APIENTRY
alGenFilters(ALsizei n
, ALuint
*filters
)
53 context
= GetContextRef();
57 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
59 device
= context
->Device
;
60 for(cur
= 0;cur
< n
;cur
++)
62 ALfilter
*filter
= al_calloc(16, sizeof(ALfilter
));
65 alDeleteFilters(cur
, filters
);
66 SET_ERROR_AND_GOTO(context
, AL_OUT_OF_MEMORY
, done
);
68 InitFilterParams(filter
, AL_FILTER_NULL
);
70 err
= NewThunkEntry(&filter
->id
);
71 if(err
== AL_NO_ERROR
)
72 err
= InsertUIntMapEntry(&device
->FilterMap
, filter
->id
, filter
);
73 if(err
!= AL_NO_ERROR
)
75 FreeThunkEntry(filter
->id
);
76 memset(filter
, 0, sizeof(ALfilter
));
79 alDeleteFilters(cur
, filters
);
80 SET_ERROR_AND_GOTO(context
, err
, done
);
83 filters
[cur
] = filter
->id
;
87 ALCcontext_DecRef(context
);
90 AL_API ALvoid AL_APIENTRY
alDeleteFilters(ALsizei n
, const ALuint
*filters
)
97 context
= GetContextRef();
100 device
= context
->Device
;
101 LockFiltersWrite(device
);
103 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
106 if(filters
[i
] && LookupFilter(device
, filters
[i
]) == NULL
)
107 SET_ERROR_AND_GOTO(context
, AL_INVALID_NAME
, done
);
111 if((filter
=RemoveFilter(device
, filters
[i
])) == NULL
)
113 FreeThunkEntry(filter
->id
);
115 memset(filter
, 0, sizeof(*filter
));
120 UnlockFiltersWrite(device
);
121 ALCcontext_DecRef(context
);
124 AL_API ALboolean AL_APIENTRY
alIsFilter(ALuint filter
)
129 Context
= GetContextRef();
130 if(!Context
) return AL_FALSE
;
132 LockFiltersRead(Context
->Device
);
133 result
= ((!filter
|| LookupFilter(Context
->Device
, filter
)) ?
135 UnlockFiltersRead(Context
->Device
);
137 ALCcontext_DecRef(Context
);
142 AL_API ALvoid AL_APIENTRY
alFilteri(ALuint filter
, ALenum param
, ALint value
)
148 Context
= GetContextRef();
151 Device
= Context
->Device
;
152 LockFiltersWrite(Device
);
153 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
154 alSetError(Context
, AL_INVALID_NAME
);
157 if(param
== AL_FILTER_TYPE
)
159 if(value
== AL_FILTER_NULL
|| value
== AL_FILTER_LOWPASS
||
160 value
== AL_FILTER_HIGHPASS
|| value
== AL_FILTER_BANDPASS
)
161 InitFilterParams(ALFilter
, value
);
163 alSetError(Context
, AL_INVALID_VALUE
);
167 /* Call the appropriate handler */
168 ALfilter_SetParami(ALFilter
, Context
, param
, value
);
171 UnlockFiltersWrite(Device
);
173 ALCcontext_DecRef(Context
);
176 AL_API ALvoid AL_APIENTRY
alFilteriv(ALuint filter
, ALenum param
, const ALint
*values
)
185 alFilteri(filter
, param
, values
[0]);
189 Context
= GetContextRef();
192 Device
= Context
->Device
;
193 LockFiltersWrite(Device
);
194 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
195 alSetError(Context
, AL_INVALID_NAME
);
198 /* Call the appropriate handler */
199 ALfilter_SetParamiv(ALFilter
, Context
, param
, values
);
201 UnlockFiltersWrite(Device
);
203 ALCcontext_DecRef(Context
);
206 AL_API ALvoid AL_APIENTRY
alFilterf(ALuint filter
, ALenum param
, ALfloat value
)
212 Context
= GetContextRef();
215 Device
= Context
->Device
;
216 LockFiltersWrite(Device
);
217 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
218 alSetError(Context
, AL_INVALID_NAME
);
221 /* Call the appropriate handler */
222 ALfilter_SetParamf(ALFilter
, Context
, param
, value
);
224 UnlockFiltersWrite(Device
);
226 ALCcontext_DecRef(Context
);
229 AL_API ALvoid AL_APIENTRY
alFilterfv(ALuint filter
, ALenum param
, const ALfloat
*values
)
235 Context
= GetContextRef();
238 Device
= Context
->Device
;
239 LockFiltersWrite(Device
);
240 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
241 alSetError(Context
, AL_INVALID_NAME
);
244 /* Call the appropriate handler */
245 ALfilter_SetParamfv(ALFilter
, Context
, param
, values
);
247 UnlockFiltersWrite(Device
);
249 ALCcontext_DecRef(Context
);
252 AL_API ALvoid AL_APIENTRY
alGetFilteri(ALuint filter
, ALenum param
, ALint
*value
)
258 Context
= GetContextRef();
261 Device
= Context
->Device
;
262 LockFiltersRead(Device
);
263 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
264 alSetError(Context
, AL_INVALID_NAME
);
267 if(param
== AL_FILTER_TYPE
)
268 *value
= ALFilter
->type
;
271 /* Call the appropriate handler */
272 ALfilter_GetParami(ALFilter
, Context
, param
, value
);
275 UnlockFiltersRead(Device
);
277 ALCcontext_DecRef(Context
);
280 AL_API ALvoid AL_APIENTRY
alGetFilteriv(ALuint filter
, ALenum param
, ALint
*values
)
289 alGetFilteri(filter
, param
, values
);
293 Context
= GetContextRef();
296 Device
= Context
->Device
;
297 LockFiltersRead(Device
);
298 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
299 alSetError(Context
, AL_INVALID_NAME
);
302 /* Call the appropriate handler */
303 ALfilter_GetParamiv(ALFilter
, Context
, param
, values
);
305 UnlockFiltersRead(Device
);
307 ALCcontext_DecRef(Context
);
310 AL_API ALvoid AL_APIENTRY
alGetFilterf(ALuint filter
, ALenum param
, ALfloat
*value
)
316 Context
= GetContextRef();
319 Device
= Context
->Device
;
320 LockFiltersRead(Device
);
321 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
322 alSetError(Context
, AL_INVALID_NAME
);
325 /* Call the appropriate handler */
326 ALfilter_GetParamf(ALFilter
, Context
, param
, value
);
328 UnlockFiltersRead(Device
);
330 ALCcontext_DecRef(Context
);
333 AL_API ALvoid AL_APIENTRY
alGetFilterfv(ALuint filter
, ALenum param
, ALfloat
*values
)
339 Context
= GetContextRef();
342 Device
= Context
->Device
;
343 LockFiltersRead(Device
);
344 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
345 alSetError(Context
, AL_INVALID_NAME
);
348 /* Call the appropriate handler */
349 ALfilter_GetParamfv(ALFilter
, Context
, param
, values
);
351 UnlockFiltersRead(Device
);
353 ALCcontext_DecRef(Context
);
357 void ALfilterState_setParams(ALfilterState
*filter
, ALfilterType type
, ALfloat gain
, ALfloat freq_mult
, ALfloat rcpQ
)
359 ALfloat alpha
, sqrtgain_alpha_2
;
360 ALfloat w0
, sin_w0
, cos_w0
;
361 ALfloat a
[3] = { 1.0f
, 0.0f
, 0.0f
};
362 ALfloat b
[3] = { 1.0f
, 0.0f
, 0.0f
};
364 // Limit gain to -100dB
365 assert(gain
> 0.00001f
);
367 w0
= F_TAU
* freq_mult
;
370 alpha
= sin_w0
/2.0f
* rcpQ
;
372 /* Calculate filter coefficients depending on filter type */
375 case ALfilterType_HighShelf
:
376 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
377 b
[0] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
378 b
[1] = -2.0f
*gain
*((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
379 b
[2] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
380 a
[0] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
381 a
[1] = 2.0f
* ((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
382 a
[2] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
384 case ALfilterType_LowShelf
:
385 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
386 b
[0] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
387 b
[1] = 2.0f
*gain
*((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
388 b
[2] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
389 a
[0] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
390 a
[1] = -2.0f
* ((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
391 a
[2] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
393 case ALfilterType_Peaking
:
395 b
[0] = 1.0f
+ alpha
* gain
;
396 b
[1] = -2.0f
* cos_w0
;
397 b
[2] = 1.0f
- alpha
* gain
;
398 a
[0] = 1.0f
+ alpha
/ gain
;
399 a
[1] = -2.0f
* cos_w0
;
400 a
[2] = 1.0f
- alpha
/ gain
;
403 case ALfilterType_LowPass
:
404 b
[0] = (1.0f
- cos_w0
) / 2.0f
;
405 b
[1] = 1.0f
- cos_w0
;
406 b
[2] = (1.0f
- cos_w0
) / 2.0f
;
408 a
[1] = -2.0f
* cos_w0
;
411 case ALfilterType_HighPass
:
412 b
[0] = (1.0f
+ cos_w0
) / 2.0f
;
413 b
[1] = -(1.0f
+ cos_w0
);
414 b
[2] = (1.0f
+ cos_w0
) / 2.0f
;
416 a
[1] = -2.0f
* cos_w0
;
419 case ALfilterType_BandPass
:
424 a
[1] = -2.0f
* cos_w0
;
429 filter
->a1
= a
[1] / a
[0];
430 filter
->a2
= a
[2] / a
[0];
431 filter
->b0
= b
[0] / a
[0];
432 filter
->b1
= b
[1] / a
[0];
433 filter
->b2
= b
[2] / a
[0];
437 static void lp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
438 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
439 static void lp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
440 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
441 static void lp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
445 case AL_LOWPASS_GAIN
:
446 if(!(val
>= AL_LOWPASS_MIN_GAIN
&& val
<= AL_LOWPASS_MAX_GAIN
))
447 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
451 case AL_LOWPASS_GAINHF
:
452 if(!(val
>= AL_LOWPASS_MIN_GAINHF
&& val
<= AL_LOWPASS_MAX_GAINHF
))
453 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
454 filter
->GainHF
= val
;
458 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
461 static void lp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
463 lp_SetParamf(filter
, context
, param
, vals
[0]);
466 static void lp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
467 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
468 static void lp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
469 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
470 static void lp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
474 case AL_LOWPASS_GAIN
:
478 case AL_LOWPASS_GAINHF
:
479 *val
= filter
->GainHF
;
483 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
486 static void lp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
488 lp_GetParamf(filter
, context
, param
, vals
);
492 static void hp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
493 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
494 static void hp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
495 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
496 static void hp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
500 case AL_HIGHPASS_GAIN
:
501 if(!(val
>= AL_HIGHPASS_MIN_GAIN
&& val
<= AL_HIGHPASS_MAX_GAIN
))
502 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
506 case AL_HIGHPASS_GAINLF
:
507 if(!(val
>= AL_HIGHPASS_MIN_GAINLF
&& val
<= AL_HIGHPASS_MAX_GAINLF
))
508 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
509 filter
->GainLF
= val
;
513 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
516 static void hp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
518 hp_SetParamf(filter
, context
, param
, vals
[0]);
521 static void hp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
522 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
523 static void hp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
524 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
525 static void hp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
529 case AL_HIGHPASS_GAIN
:
533 case AL_HIGHPASS_GAINLF
:
534 *val
= filter
->GainLF
;
538 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
541 static void hp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
543 hp_GetParamf(filter
, context
, param
, vals
);
547 static void bp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
548 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
549 static void bp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
550 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
551 static void bp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
555 case AL_BANDPASS_GAIN
:
556 if(!(val
>= AL_BANDPASS_MIN_GAIN
&& val
<= AL_BANDPASS_MAX_GAIN
))
557 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
561 case AL_BANDPASS_GAINHF
:
562 if(!(val
>= AL_BANDPASS_MIN_GAINHF
&& val
<= AL_BANDPASS_MAX_GAINHF
))
563 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
564 filter
->GainHF
= val
;
567 case AL_BANDPASS_GAINLF
:
568 if(!(val
>= AL_BANDPASS_MIN_GAINLF
&& val
<= AL_BANDPASS_MAX_GAINLF
))
569 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
570 filter
->GainLF
= val
;
574 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
577 static void bp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
579 bp_SetParamf(filter
, context
, param
, vals
[0]);
582 static void bp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
583 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
584 static void bp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
585 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
586 static void bp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
590 case AL_BANDPASS_GAIN
:
594 case AL_BANDPASS_GAINHF
:
595 *val
= filter
->GainHF
;
598 case AL_BANDPASS_GAINLF
:
599 *val
= filter
->GainLF
;
603 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
606 static void bp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
608 bp_GetParamf(filter
, context
, param
, vals
);
612 static void null_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
613 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
614 static void null_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
615 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
616 static void null_SetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
UNUSED(val
))
617 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
618 static void null_SetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALfloat
*UNUSED(vals
))
619 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
621 static void null_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
622 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
623 static void null_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
624 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
625 static void null_GetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(val
))
626 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
627 static void null_GetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(vals
))
628 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
631 ALvoid
ReleaseALFilters(ALCdevice
*device
)
634 for(i
= 0;i
< device
->FilterMap
.size
;i
++)
636 ALfilter
*temp
= device
->FilterMap
.values
[i
];
637 device
->FilterMap
.values
[i
] = NULL
;
639 // Release filter structure
640 FreeThunkEntry(temp
->id
);
641 memset(temp
, 0, sizeof(ALfilter
));
647 static void InitFilterParams(ALfilter
*filter
, ALenum type
)
649 if(type
== AL_FILTER_LOWPASS
)
651 filter
->Gain
= AL_LOWPASS_DEFAULT_GAIN
;
652 filter
->GainHF
= AL_LOWPASS_DEFAULT_GAINHF
;
653 filter
->HFReference
= LOWPASSFREQREF
;
654 filter
->GainLF
= 1.0f
;
655 filter
->LFReference
= HIGHPASSFREQREF
;
657 filter
->SetParami
= lp_SetParami
;
658 filter
->SetParamiv
= lp_SetParamiv
;
659 filter
->SetParamf
= lp_SetParamf
;
660 filter
->SetParamfv
= lp_SetParamfv
;
661 filter
->GetParami
= lp_GetParami
;
662 filter
->GetParamiv
= lp_GetParamiv
;
663 filter
->GetParamf
= lp_GetParamf
;
664 filter
->GetParamfv
= lp_GetParamfv
;
666 else if(type
== AL_FILTER_HIGHPASS
)
668 filter
->Gain
= AL_HIGHPASS_DEFAULT_GAIN
;
669 filter
->GainHF
= 1.0f
;
670 filter
->HFReference
= LOWPASSFREQREF
;
671 filter
->GainLF
= AL_HIGHPASS_DEFAULT_GAINLF
;
672 filter
->LFReference
= HIGHPASSFREQREF
;
674 filter
->SetParami
= hp_SetParami
;
675 filter
->SetParamiv
= hp_SetParamiv
;
676 filter
->SetParamf
= hp_SetParamf
;
677 filter
->SetParamfv
= hp_SetParamfv
;
678 filter
->GetParami
= hp_GetParami
;
679 filter
->GetParamiv
= hp_GetParamiv
;
680 filter
->GetParamf
= hp_GetParamf
;
681 filter
->GetParamfv
= hp_GetParamfv
;
683 else if(type
== AL_FILTER_BANDPASS
)
685 filter
->Gain
= AL_BANDPASS_DEFAULT_GAIN
;
686 filter
->GainHF
= AL_BANDPASS_DEFAULT_GAINHF
;
687 filter
->HFReference
= LOWPASSFREQREF
;
688 filter
->GainLF
= AL_BANDPASS_DEFAULT_GAINLF
;
689 filter
->LFReference
= HIGHPASSFREQREF
;
691 filter
->SetParami
= bp_SetParami
;
692 filter
->SetParamiv
= bp_SetParamiv
;
693 filter
->SetParamf
= bp_SetParamf
;
694 filter
->SetParamfv
= bp_SetParamfv
;
695 filter
->GetParami
= bp_GetParami
;
696 filter
->GetParamiv
= bp_GetParamiv
;
697 filter
->GetParamf
= bp_GetParamf
;
698 filter
->GetParamfv
= bp_GetParamfv
;
703 filter
->GainHF
= 1.0f
;
704 filter
->HFReference
= LOWPASSFREQREF
;
705 filter
->GainLF
= 1.0f
;
706 filter
->LFReference
= HIGHPASSFREQREF
;
708 filter
->SetParami
= null_SetParami
;
709 filter
->SetParamiv
= null_SetParamiv
;
710 filter
->SetParamf
= null_SetParamf
;
711 filter
->SetParamfv
= null_SetParamfv
;
712 filter
->GetParami
= null_GetParami
;
713 filter
->GetParamiv
= null_GetParamiv
;
714 filter
->GetParamf
= null_GetParamf
;
715 filter
->GetParamfv
= null_GetParamfv
;