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_copyParams(ALfilterState
*restrict dst
, const ALfilterState
*restrict src
);
40 extern inline void ALfilterState_processPassthru(ALfilterState
*filter
, const ALfloat
*restrict src
, ALsizei numsamples
);
41 extern inline ALfloat
calc_rcpQ_from_slope(ALfloat gain
, ALfloat slope
);
42 extern inline ALfloat
calc_rcpQ_from_bandwidth(ALfloat freq_mult
, ALfloat bandwidth
);
44 static void InitFilterParams(ALfilter
*filter
, ALenum type
);
47 AL_API ALvoid AL_APIENTRY
alGenFilters(ALsizei n
, ALuint
*filters
)
54 context
= GetContextRef();
58 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
60 device
= context
->Device
;
61 for(cur
= 0;cur
< n
;cur
++)
63 ALfilter
*filter
= al_calloc(16, sizeof(ALfilter
));
66 alDeleteFilters(cur
, filters
);
67 SET_ERROR_AND_GOTO(context
, AL_OUT_OF_MEMORY
, done
);
69 InitFilterParams(filter
, AL_FILTER_NULL
);
71 err
= NewThunkEntry(&filter
->id
);
72 if(err
== AL_NO_ERROR
)
73 err
= InsertUIntMapEntry(&device
->FilterMap
, filter
->id
, filter
);
74 if(err
!= AL_NO_ERROR
)
76 FreeThunkEntry(filter
->id
);
77 memset(filter
, 0, sizeof(ALfilter
));
80 alDeleteFilters(cur
, filters
);
81 SET_ERROR_AND_GOTO(context
, err
, done
);
84 filters
[cur
] = filter
->id
;
88 ALCcontext_DecRef(context
);
91 AL_API ALvoid AL_APIENTRY
alDeleteFilters(ALsizei n
, const ALuint
*filters
)
98 context
= GetContextRef();
101 device
= context
->Device
;
102 LockFiltersWrite(device
);
104 SET_ERROR_AND_GOTO(context
, AL_INVALID_VALUE
, done
);
107 if(filters
[i
] && LookupFilter(device
, filters
[i
]) == NULL
)
108 SET_ERROR_AND_GOTO(context
, AL_INVALID_NAME
, done
);
112 if((filter
=RemoveFilter(device
, filters
[i
])) == NULL
)
114 FreeThunkEntry(filter
->id
);
116 memset(filter
, 0, sizeof(*filter
));
121 UnlockFiltersWrite(device
);
122 ALCcontext_DecRef(context
);
125 AL_API ALboolean AL_APIENTRY
alIsFilter(ALuint filter
)
130 Context
= GetContextRef();
131 if(!Context
) return AL_FALSE
;
133 LockFiltersRead(Context
->Device
);
134 result
= ((!filter
|| LookupFilter(Context
->Device
, filter
)) ?
136 UnlockFiltersRead(Context
->Device
);
138 ALCcontext_DecRef(Context
);
143 AL_API ALvoid AL_APIENTRY
alFilteri(ALuint filter
, ALenum param
, ALint value
)
149 Context
= GetContextRef();
152 Device
= Context
->Device
;
153 LockFiltersWrite(Device
);
154 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
155 alSetError(Context
, AL_INVALID_NAME
);
158 if(param
== AL_FILTER_TYPE
)
160 if(value
== AL_FILTER_NULL
|| value
== AL_FILTER_LOWPASS
||
161 value
== AL_FILTER_HIGHPASS
|| value
== AL_FILTER_BANDPASS
)
162 InitFilterParams(ALFilter
, value
);
164 alSetError(Context
, AL_INVALID_VALUE
);
168 /* Call the appropriate handler */
169 ALfilter_SetParami(ALFilter
, Context
, param
, value
);
172 UnlockFiltersWrite(Device
);
174 ALCcontext_DecRef(Context
);
177 AL_API ALvoid AL_APIENTRY
alFilteriv(ALuint filter
, ALenum param
, const ALint
*values
)
186 alFilteri(filter
, param
, values
[0]);
190 Context
= GetContextRef();
193 Device
= Context
->Device
;
194 LockFiltersWrite(Device
);
195 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
196 alSetError(Context
, AL_INVALID_NAME
);
199 /* Call the appropriate handler */
200 ALfilter_SetParamiv(ALFilter
, Context
, param
, values
);
202 UnlockFiltersWrite(Device
);
204 ALCcontext_DecRef(Context
);
207 AL_API ALvoid AL_APIENTRY
alFilterf(ALuint filter
, ALenum param
, ALfloat value
)
213 Context
= GetContextRef();
216 Device
= Context
->Device
;
217 LockFiltersWrite(Device
);
218 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
219 alSetError(Context
, AL_INVALID_NAME
);
222 /* Call the appropriate handler */
223 ALfilter_SetParamf(ALFilter
, Context
, param
, value
);
225 UnlockFiltersWrite(Device
);
227 ALCcontext_DecRef(Context
);
230 AL_API ALvoid AL_APIENTRY
alFilterfv(ALuint filter
, ALenum param
, const ALfloat
*values
)
236 Context
= GetContextRef();
239 Device
= Context
->Device
;
240 LockFiltersWrite(Device
);
241 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
242 alSetError(Context
, AL_INVALID_NAME
);
245 /* Call the appropriate handler */
246 ALfilter_SetParamfv(ALFilter
, Context
, param
, values
);
248 UnlockFiltersWrite(Device
);
250 ALCcontext_DecRef(Context
);
253 AL_API ALvoid AL_APIENTRY
alGetFilteri(ALuint filter
, ALenum param
, ALint
*value
)
259 Context
= GetContextRef();
262 Device
= Context
->Device
;
263 LockFiltersRead(Device
);
264 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
265 alSetError(Context
, AL_INVALID_NAME
);
268 if(param
== AL_FILTER_TYPE
)
269 *value
= ALFilter
->type
;
272 /* Call the appropriate handler */
273 ALfilter_GetParami(ALFilter
, Context
, param
, value
);
276 UnlockFiltersRead(Device
);
278 ALCcontext_DecRef(Context
);
281 AL_API ALvoid AL_APIENTRY
alGetFilteriv(ALuint filter
, ALenum param
, ALint
*values
)
290 alGetFilteri(filter
, param
, values
);
294 Context
= GetContextRef();
297 Device
= Context
->Device
;
298 LockFiltersRead(Device
);
299 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
300 alSetError(Context
, AL_INVALID_NAME
);
303 /* Call the appropriate handler */
304 ALfilter_GetParamiv(ALFilter
, Context
, param
, values
);
306 UnlockFiltersRead(Device
);
308 ALCcontext_DecRef(Context
);
311 AL_API ALvoid AL_APIENTRY
alGetFilterf(ALuint filter
, ALenum param
, ALfloat
*value
)
317 Context
= GetContextRef();
320 Device
= Context
->Device
;
321 LockFiltersRead(Device
);
322 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
323 alSetError(Context
, AL_INVALID_NAME
);
326 /* Call the appropriate handler */
327 ALfilter_GetParamf(ALFilter
, Context
, param
, value
);
329 UnlockFiltersRead(Device
);
331 ALCcontext_DecRef(Context
);
334 AL_API ALvoid AL_APIENTRY
alGetFilterfv(ALuint filter
, ALenum param
, ALfloat
*values
)
340 Context
= GetContextRef();
343 Device
= Context
->Device
;
344 LockFiltersRead(Device
);
345 if((ALFilter
=LookupFilter(Device
, filter
)) == NULL
)
346 alSetError(Context
, AL_INVALID_NAME
);
349 /* Call the appropriate handler */
350 ALfilter_GetParamfv(ALFilter
, Context
, param
, values
);
352 UnlockFiltersRead(Device
);
354 ALCcontext_DecRef(Context
);
358 void ALfilterState_setParams(ALfilterState
*filter
, ALfilterType type
, ALfloat gain
, ALfloat freq_mult
, ALfloat rcpQ
)
360 ALfloat alpha
, sqrtgain_alpha_2
;
361 ALfloat w0
, sin_w0
, cos_w0
;
362 ALfloat a
[3] = { 1.0f
, 0.0f
, 0.0f
};
363 ALfloat b
[3] = { 1.0f
, 0.0f
, 0.0f
};
365 // Limit gain to -100dB
366 assert(gain
> 0.00001f
);
368 w0
= F_TAU
* freq_mult
;
371 alpha
= sin_w0
/2.0f
* rcpQ
;
373 /* Calculate filter coefficients depending on filter type */
376 case ALfilterType_HighShelf
:
377 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
378 b
[0] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
379 b
[1] = -2.0f
*gain
*((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
380 b
[2] = gain
*((gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
381 a
[0] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
382 a
[1] = 2.0f
* ((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
383 a
[2] = (gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
385 case ALfilterType_LowShelf
:
386 sqrtgain_alpha_2
= 2.0f
* sqrtf(gain
) * alpha
;
387 b
[0] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
);
388 b
[1] = 2.0f
*gain
*((gain
-1.0f
) - (gain
+1.0f
)*cos_w0
);
389 b
[2] = gain
*((gain
+1.0f
) - (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
);
390 a
[0] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
+ sqrtgain_alpha_2
;
391 a
[1] = -2.0f
* ((gain
-1.0f
) + (gain
+1.0f
)*cos_w0
);
392 a
[2] = (gain
+1.0f
) + (gain
-1.0f
)*cos_w0
- sqrtgain_alpha_2
;
394 case ALfilterType_Peaking
:
396 b
[0] = 1.0f
+ alpha
* gain
;
397 b
[1] = -2.0f
* cos_w0
;
398 b
[2] = 1.0f
- alpha
* gain
;
399 a
[0] = 1.0f
+ alpha
/ gain
;
400 a
[1] = -2.0f
* cos_w0
;
401 a
[2] = 1.0f
- alpha
/ gain
;
404 case ALfilterType_LowPass
:
405 b
[0] = (1.0f
- cos_w0
) / 2.0f
;
406 b
[1] = 1.0f
- cos_w0
;
407 b
[2] = (1.0f
- cos_w0
) / 2.0f
;
409 a
[1] = -2.0f
* cos_w0
;
412 case ALfilterType_HighPass
:
413 b
[0] = (1.0f
+ cos_w0
) / 2.0f
;
414 b
[1] = -(1.0f
+ cos_w0
);
415 b
[2] = (1.0f
+ cos_w0
) / 2.0f
;
417 a
[1] = -2.0f
* cos_w0
;
420 case ALfilterType_BandPass
:
425 a
[1] = -2.0f
* cos_w0
;
430 filter
->a1
= a
[1] / a
[0];
431 filter
->a2
= a
[2] / a
[0];
432 filter
->b0
= b
[0] / a
[0];
433 filter
->b1
= b
[1] / a
[0];
434 filter
->b2
= b
[2] / a
[0];
438 static void lp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
439 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
440 static void lp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
441 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
442 static void lp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
446 case AL_LOWPASS_GAIN
:
447 if(!(val
>= AL_LOWPASS_MIN_GAIN
&& val
<= AL_LOWPASS_MAX_GAIN
))
448 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
452 case AL_LOWPASS_GAINHF
:
453 if(!(val
>= AL_LOWPASS_MIN_GAINHF
&& val
<= AL_LOWPASS_MAX_GAINHF
))
454 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
455 filter
->GainHF
= val
;
459 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
462 static void lp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
464 lp_SetParamf(filter
, context
, param
, vals
[0]);
467 static void lp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
468 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
469 static void lp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
470 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
471 static void lp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
475 case AL_LOWPASS_GAIN
:
479 case AL_LOWPASS_GAINHF
:
480 *val
= filter
->GainHF
;
484 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
487 static void lp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
489 lp_GetParamf(filter
, context
, param
, vals
);
493 static void hp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
494 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
495 static void hp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
496 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
497 static void hp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
501 case AL_HIGHPASS_GAIN
:
502 if(!(val
>= AL_HIGHPASS_MIN_GAIN
&& val
<= AL_HIGHPASS_MAX_GAIN
))
503 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
507 case AL_HIGHPASS_GAINLF
:
508 if(!(val
>= AL_HIGHPASS_MIN_GAINLF
&& val
<= AL_HIGHPASS_MAX_GAINLF
))
509 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
510 filter
->GainLF
= val
;
514 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
517 static void hp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
519 hp_SetParamf(filter
, context
, param
, vals
[0]);
522 static void hp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
523 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
524 static void hp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
525 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
526 static void hp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
530 case AL_HIGHPASS_GAIN
:
534 case AL_HIGHPASS_GAINLF
:
535 *val
= filter
->GainLF
;
539 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
542 static void hp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
544 hp_GetParamf(filter
, context
, param
, vals
);
548 static void bp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
549 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
550 static void bp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
551 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
552 static void bp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
556 case AL_BANDPASS_GAIN
:
557 if(!(val
>= AL_BANDPASS_MIN_GAIN
&& val
<= AL_BANDPASS_MAX_GAIN
))
558 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
562 case AL_BANDPASS_GAINHF
:
563 if(!(val
>= AL_BANDPASS_MIN_GAINHF
&& val
<= AL_BANDPASS_MAX_GAINHF
))
564 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
565 filter
->GainHF
= val
;
568 case AL_BANDPASS_GAINLF
:
569 if(!(val
>= AL_BANDPASS_MIN_GAINLF
&& val
<= AL_BANDPASS_MAX_GAINLF
))
570 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
571 filter
->GainLF
= val
;
575 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
578 static void bp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
580 bp_SetParamf(filter
, context
, param
, vals
[0]);
583 static void bp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
584 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
585 static void bp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
586 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
587 static void bp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
591 case AL_BANDPASS_GAIN
:
595 case AL_BANDPASS_GAINHF
:
596 *val
= filter
->GainHF
;
599 case AL_BANDPASS_GAINLF
:
600 *val
= filter
->GainLF
;
604 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
607 static void bp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
609 bp_GetParamf(filter
, context
, param
, vals
);
613 static void null_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
614 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
615 static void null_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
616 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
617 static void null_SetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
UNUSED(val
))
618 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
619 static void null_SetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALfloat
*UNUSED(vals
))
620 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
622 static void null_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
623 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
624 static void null_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
625 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
626 static void null_GetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(val
))
627 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
628 static void null_GetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(vals
))
629 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
632 ALvoid
ReleaseALFilters(ALCdevice
*device
)
635 for(i
= 0;i
< device
->FilterMap
.size
;i
++)
637 ALfilter
*temp
= device
->FilterMap
.values
[i
];
638 device
->FilterMap
.values
[i
] = NULL
;
640 // Release filter structure
641 FreeThunkEntry(temp
->id
);
642 memset(temp
, 0, sizeof(ALfilter
));
648 static void InitFilterParams(ALfilter
*filter
, ALenum type
)
650 if(type
== AL_FILTER_LOWPASS
)
652 filter
->Gain
= AL_LOWPASS_DEFAULT_GAIN
;
653 filter
->GainHF
= AL_LOWPASS_DEFAULT_GAINHF
;
654 filter
->HFReference
= LOWPASSFREQREF
;
655 filter
->GainLF
= 1.0f
;
656 filter
->LFReference
= HIGHPASSFREQREF
;
658 filter
->SetParami
= lp_SetParami
;
659 filter
->SetParamiv
= lp_SetParamiv
;
660 filter
->SetParamf
= lp_SetParamf
;
661 filter
->SetParamfv
= lp_SetParamfv
;
662 filter
->GetParami
= lp_GetParami
;
663 filter
->GetParamiv
= lp_GetParamiv
;
664 filter
->GetParamf
= lp_GetParamf
;
665 filter
->GetParamfv
= lp_GetParamfv
;
667 else if(type
== AL_FILTER_HIGHPASS
)
669 filter
->Gain
= AL_HIGHPASS_DEFAULT_GAIN
;
670 filter
->GainHF
= 1.0f
;
671 filter
->HFReference
= LOWPASSFREQREF
;
672 filter
->GainLF
= AL_HIGHPASS_DEFAULT_GAINLF
;
673 filter
->LFReference
= HIGHPASSFREQREF
;
675 filter
->SetParami
= hp_SetParami
;
676 filter
->SetParamiv
= hp_SetParamiv
;
677 filter
->SetParamf
= hp_SetParamf
;
678 filter
->SetParamfv
= hp_SetParamfv
;
679 filter
->GetParami
= hp_GetParami
;
680 filter
->GetParamiv
= hp_GetParamiv
;
681 filter
->GetParamf
= hp_GetParamf
;
682 filter
->GetParamfv
= hp_GetParamfv
;
684 else if(type
== AL_FILTER_BANDPASS
)
686 filter
->Gain
= AL_BANDPASS_DEFAULT_GAIN
;
687 filter
->GainHF
= AL_BANDPASS_DEFAULT_GAINHF
;
688 filter
->HFReference
= LOWPASSFREQREF
;
689 filter
->GainLF
= AL_BANDPASS_DEFAULT_GAINLF
;
690 filter
->LFReference
= HIGHPASSFREQREF
;
692 filter
->SetParami
= bp_SetParami
;
693 filter
->SetParamiv
= bp_SetParamiv
;
694 filter
->SetParamf
= bp_SetParamf
;
695 filter
->SetParamfv
= bp_SetParamfv
;
696 filter
->GetParami
= bp_GetParami
;
697 filter
->GetParamiv
= bp_GetParamiv
;
698 filter
->GetParamf
= bp_GetParamf
;
699 filter
->GetParamfv
= bp_GetParamfv
;
704 filter
->GainHF
= 1.0f
;
705 filter
->HFReference
= LOWPASSFREQREF
;
706 filter
->GainLF
= 1.0f
;
707 filter
->LFReference
= HIGHPASSFREQREF
;
709 filter
->SetParami
= null_SetParami
;
710 filter
->SetParamiv
= null_SetParamiv
;
711 filter
->SetParamf
= null_SetParamf
;
712 filter
->SetParamfv
= null_SetParamfv
;
713 filter
->GetParami
= null_GetParami
;
714 filter
->GetParamiv
= null_GetParamiv
;
715 filter
->GetParamf
= null_GetParamf
;
716 filter
->GetParamfv
= null_GetParamfv
;