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
, ALuint 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 gain
= maxf(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];
435 filter
->process
= ALfilterState_processC
;
439 static void lp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
440 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
441 static void lp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
442 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
443 static void lp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
447 case AL_LOWPASS_GAIN
:
448 if(!(val
>= AL_LOWPASS_MIN_GAIN
&& val
<= AL_LOWPASS_MAX_GAIN
))
449 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
453 case AL_LOWPASS_GAINHF
:
454 if(!(val
>= AL_LOWPASS_MIN_GAINHF
&& val
<= AL_LOWPASS_MAX_GAINHF
))
455 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
456 filter
->GainHF
= val
;
460 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
463 static void lp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
465 lp_SetParamf(filter
, context
, param
, vals
[0]);
468 static void lp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
469 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
470 static void lp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
471 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
472 static void lp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
476 case AL_LOWPASS_GAIN
:
480 case AL_LOWPASS_GAINHF
:
481 *val
= filter
->GainHF
;
485 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
488 static void lp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
490 lp_GetParamf(filter
, context
, param
, vals
);
494 static void hp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
495 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
496 static void hp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
497 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
498 static void hp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
502 case AL_HIGHPASS_GAIN
:
503 if(!(val
>= AL_HIGHPASS_MIN_GAIN
&& val
<= AL_HIGHPASS_MAX_GAIN
))
504 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
508 case AL_HIGHPASS_GAINLF
:
509 if(!(val
>= AL_HIGHPASS_MIN_GAINLF
&& val
<= AL_HIGHPASS_MAX_GAINLF
))
510 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
511 filter
->GainLF
= val
;
515 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
518 static void hp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
520 hp_SetParamf(filter
, context
, param
, vals
[0]);
523 static void hp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
524 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
525 static void hp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
526 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
527 static void hp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
531 case AL_HIGHPASS_GAIN
:
535 case AL_HIGHPASS_GAINLF
:
536 *val
= filter
->GainLF
;
540 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
543 static void hp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
545 hp_GetParamf(filter
, context
, param
, vals
);
549 static void bp_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
550 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
551 static void bp_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
552 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
553 static void bp_SetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
)
557 case AL_BANDPASS_GAIN
:
558 if(!(val
>= AL_BANDPASS_MIN_GAIN
&& val
<= AL_BANDPASS_MAX_GAIN
))
559 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
563 case AL_BANDPASS_GAINHF
:
564 if(!(val
>= AL_BANDPASS_MIN_GAINHF
&& val
<= AL_BANDPASS_MAX_GAINHF
))
565 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
566 filter
->GainHF
= val
;
569 case AL_BANDPASS_GAINLF
:
570 if(!(val
>= AL_BANDPASS_MIN_GAINLF
&& val
<= AL_BANDPASS_MAX_GAINLF
))
571 SET_ERROR_AND_RETURN(context
, AL_INVALID_VALUE
);
572 filter
->GainLF
= val
;
576 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
579 static void bp_SetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
581 bp_SetParamf(filter
, context
, param
, vals
[0]);
584 static void bp_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
585 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
586 static void bp_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
587 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
588 static void bp_GetParamf(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
592 case AL_BANDPASS_GAIN
:
596 case AL_BANDPASS_GAINHF
:
597 *val
= filter
->GainHF
;
600 case AL_BANDPASS_GAINLF
:
601 *val
= filter
->GainLF
;
605 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
608 static void bp_GetParamfv(ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
610 bp_GetParamf(filter
, context
, param
, vals
);
614 static void null_SetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
UNUSED(val
))
615 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
616 static void null_SetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALint
*UNUSED(vals
))
617 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
618 static void null_SetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
UNUSED(val
))
619 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
620 static void null_SetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), const ALfloat
*UNUSED(vals
))
621 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
623 static void null_GetParami(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(val
))
624 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
625 static void null_GetParamiv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALint
*UNUSED(vals
))
626 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
627 static void null_GetParamf(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(val
))
628 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
629 static void null_GetParamfv(ALfilter
*UNUSED(filter
), ALCcontext
*context
, ALenum
UNUSED(param
), ALfloat
*UNUSED(vals
))
630 { SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
); }
633 ALvoid
ReleaseALFilters(ALCdevice
*device
)
636 for(i
= 0;i
< device
->FilterMap
.size
;i
++)
638 ALfilter
*temp
= device
->FilterMap
.values
[i
];
639 device
->FilterMap
.values
[i
] = NULL
;
641 // Release filter structure
642 FreeThunkEntry(temp
->id
);
643 memset(temp
, 0, sizeof(ALfilter
));
649 static void InitFilterParams(ALfilter
*filter
, ALenum type
)
651 if(type
== AL_FILTER_LOWPASS
)
653 filter
->Gain
= AL_LOWPASS_DEFAULT_GAIN
;
654 filter
->GainHF
= AL_LOWPASS_DEFAULT_GAINHF
;
655 filter
->HFReference
= LOWPASSFREQREF
;
656 filter
->GainLF
= 1.0f
;
657 filter
->LFReference
= HIGHPASSFREQREF
;
659 filter
->SetParami
= lp_SetParami
;
660 filter
->SetParamiv
= lp_SetParamiv
;
661 filter
->SetParamf
= lp_SetParamf
;
662 filter
->SetParamfv
= lp_SetParamfv
;
663 filter
->GetParami
= lp_GetParami
;
664 filter
->GetParamiv
= lp_GetParamiv
;
665 filter
->GetParamf
= lp_GetParamf
;
666 filter
->GetParamfv
= lp_GetParamfv
;
668 else if(type
== AL_FILTER_HIGHPASS
)
670 filter
->Gain
= AL_HIGHPASS_DEFAULT_GAIN
;
671 filter
->GainHF
= 1.0f
;
672 filter
->HFReference
= LOWPASSFREQREF
;
673 filter
->GainLF
= AL_HIGHPASS_DEFAULT_GAINLF
;
674 filter
->LFReference
= HIGHPASSFREQREF
;
676 filter
->SetParami
= hp_SetParami
;
677 filter
->SetParamiv
= hp_SetParamiv
;
678 filter
->SetParamf
= hp_SetParamf
;
679 filter
->SetParamfv
= hp_SetParamfv
;
680 filter
->GetParami
= hp_GetParami
;
681 filter
->GetParamiv
= hp_GetParamiv
;
682 filter
->GetParamf
= hp_GetParamf
;
683 filter
->GetParamfv
= hp_GetParamfv
;
685 else if(type
== AL_FILTER_BANDPASS
)
687 filter
->Gain
= AL_BANDPASS_DEFAULT_GAIN
;
688 filter
->GainHF
= AL_BANDPASS_DEFAULT_GAINHF
;
689 filter
->HFReference
= LOWPASSFREQREF
;
690 filter
->GainLF
= AL_BANDPASS_DEFAULT_GAINLF
;
691 filter
->LFReference
= HIGHPASSFREQREF
;
693 filter
->SetParami
= bp_SetParami
;
694 filter
->SetParamiv
= bp_SetParamiv
;
695 filter
->SetParamf
= bp_SetParamf
;
696 filter
->SetParamfv
= bp_SetParamfv
;
697 filter
->GetParami
= bp_GetParami
;
698 filter
->GetParamiv
= bp_GetParamiv
;
699 filter
->GetParamf
= bp_GetParamf
;
700 filter
->GetParamfv
= bp_GetParamfv
;
705 filter
->GainHF
= 1.0f
;
706 filter
->HFReference
= LOWPASSFREQREF
;
707 filter
->GainLF
= 1.0f
;
708 filter
->LFReference
= HIGHPASSFREQREF
;
710 filter
->SetParami
= null_SetParami
;
711 filter
->SetParamiv
= null_SetParamiv
;
712 filter
->SetParamf
= null_SetParamf
;
713 filter
->SetParamfv
= null_SetParamfv
;
714 filter
->GetParami
= null_GetParami
;
715 filter
->GetParamiv
= null_GetParamiv
;
716 filter
->GetParamf
= null_GetParamf
;
717 filter
->GetParamfv
= null_GetParamfv
;