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
34 ALboolean DisabledEffects
[MAX_EFFECTS
];
37 static void InitEffectParams(ALeffect
*effect
, ALenum type
);
40 AL_API ALvoid AL_APIENTRY
alGenEffects(ALsizei n
, ALuint
*effects
)
45 Context
= GetContextRef();
48 if(n
< 0 || IsBadWritePtr((void*)effects
, n
* sizeof(ALuint
)))
49 alSetError(Context
, AL_INVALID_VALUE
);
52 ALCdevice
*device
= Context
->Device
;
57 ALeffect
*effect
= calloc(1, sizeof(ALeffect
));
58 if(!effect
|| InitEffect(effect
) != AL_NO_ERROR
)
61 alSetError(Context
, AL_OUT_OF_MEMORY
);
62 alDeleteEffects(i
, effects
);
66 err
= NewThunkEntry(&effect
->effect
);
67 if(err
== AL_NO_ERROR
)
68 err
= InsertUIntMapEntry(&device
->EffectMap
, effect
->effect
, effect
);
69 if(err
!= AL_NO_ERROR
)
71 FreeThunkEntry(effect
->effect
);
72 memset(effect
, 0, sizeof(ALeffect
));
75 alSetError(Context
, err
);
76 alDeleteEffects(i
, effects
);
80 effects
[i
] = effect
->effect
;
84 ALCcontext_DecRef(Context
);
87 AL_API ALvoid AL_APIENTRY
alDeleteEffects(ALsizei n
, const ALuint
*effects
)
94 Context
= GetContextRef();
97 device
= Context
->Device
;
99 alSetError(Context
, AL_INVALID_VALUE
);
102 // Check that all effects are valid
108 if(LookupEffect(device
, effects
[i
]) == NULL
)
110 alSetError(Context
, AL_INVALID_NAME
);
118 // Recheck that the effect is valid, because there could be duplicated names
119 if((ALEffect
=RemoveEffect(device
, effects
[i
])) == NULL
)
121 FreeThunkEntry(ALEffect
->effect
);
123 memset(ALEffect
, 0, sizeof(ALeffect
));
128 ALCcontext_DecRef(Context
);
131 AL_API ALboolean AL_APIENTRY
alIsEffect(ALuint effect
)
136 Context
= GetContextRef();
137 if(!Context
) return AL_FALSE
;
139 result
= ((!effect
|| LookupEffect(Context
->Device
, effect
)) ?
142 ALCcontext_DecRef(Context
);
147 AL_API ALvoid AL_APIENTRY
alEffecti(ALuint effect
, ALenum param
, ALint iValue
)
153 Context
= GetContextRef();
156 Device
= Context
->Device
;
157 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
159 if(param
== AL_EFFECT_TYPE
)
161 ALboolean isOk
= (iValue
== AL_EFFECT_NULL
);
163 for(i
= 0;!isOk
&& EffectList
[i
].val
;i
++)
165 if(iValue
== EffectList
[i
].val
&&
166 !DisabledEffects
[EffectList
[i
].type
])
171 InitEffectParams(ALEffect
, iValue
);
173 alSetError(Context
, AL_INVALID_VALUE
);
177 /* Call the appropriate handler */
178 ALeffect_SetParami(ALEffect
, Context
, param
, iValue
);
182 alSetError(Context
, AL_INVALID_NAME
);
184 ALCcontext_DecRef(Context
);
187 AL_API ALvoid AL_APIENTRY
alEffectiv(ALuint effect
, ALenum param
, const ALint
*piValues
)
193 Context
= GetContextRef();
196 Device
= Context
->Device
;
197 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
199 /* Call the appropriate handler */
200 ALeffect_SetParamiv(ALEffect
, Context
, param
, piValues
);
203 alSetError(Context
, AL_INVALID_NAME
);
205 ALCcontext_DecRef(Context
);
208 AL_API ALvoid AL_APIENTRY
alEffectf(ALuint effect
, ALenum param
, ALfloat flValue
)
214 Context
= GetContextRef();
217 Device
= Context
->Device
;
218 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
220 /* Call the appropriate handler */
221 ALeffect_SetParamf(ALEffect
, Context
, param
, flValue
);
224 alSetError(Context
, AL_INVALID_NAME
);
226 ALCcontext_DecRef(Context
);
229 AL_API ALvoid AL_APIENTRY
alEffectfv(ALuint effect
, ALenum param
, const ALfloat
*pflValues
)
235 Context
= GetContextRef();
238 Device
= Context
->Device
;
239 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
241 /* Call the appropriate handler */
242 ALeffect_SetParamfv(ALEffect
, Context
, param
, pflValues
);
245 alSetError(Context
, AL_INVALID_NAME
);
247 ALCcontext_DecRef(Context
);
250 AL_API ALvoid AL_APIENTRY
alGetEffecti(ALuint effect
, ALenum param
, ALint
*piValue
)
256 Context
= GetContextRef();
259 Device
= Context
->Device
;
260 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
262 if(param
== AL_EFFECT_TYPE
)
264 *piValue
= ALEffect
->type
;
268 /* Call the appropriate handler */
269 ALeffect_GetParamiv(ALEffect
, Context
, param
, piValue
);
273 alSetError(Context
, AL_INVALID_NAME
);
275 ALCcontext_DecRef(Context
);
278 AL_API ALvoid AL_APIENTRY
alGetEffectiv(ALuint effect
, ALenum param
, ALint
*piValues
)
284 Context
= GetContextRef();
287 Device
= Context
->Device
;
288 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
290 /* Call the appropriate handler */
291 ALeffect_GetParamiv(ALEffect
, Context
, param
, piValues
);
294 alSetError(Context
, AL_INVALID_NAME
);
296 ALCcontext_DecRef(Context
);
299 AL_API ALvoid AL_APIENTRY
alGetEffectf(ALuint effect
, ALenum param
, ALfloat
*pflValue
)
305 Context
= GetContextRef();
308 Device
= Context
->Device
;
309 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
311 /* Call the appropriate handler */
312 ALeffect_GetParamf(ALEffect
, Context
, param
, pflValue
);
315 alSetError(Context
, AL_INVALID_NAME
);
317 ALCcontext_DecRef(Context
);
320 AL_API ALvoid AL_APIENTRY
alGetEffectfv(ALuint effect
, ALenum param
, ALfloat
*pflValues
)
326 Context
= GetContextRef();
329 Device
= Context
->Device
;
330 if((ALEffect
=LookupEffect(Device
, effect
)) != NULL
)
332 /* Call the appropriate handler */
333 ALeffect_GetParamfv(ALEffect
, Context
, param
, pflValues
);
336 alSetError(Context
, AL_INVALID_NAME
);
338 ALCcontext_DecRef(Context
);
342 static void eaxreverb_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
346 case AL_EAXREVERB_DECAY_HFLIMIT
:
347 if(val
>= AL_EAXREVERB_MIN_DECAY_HFLIMIT
&& val
<= AL_EAXREVERB_MAX_DECAY_HFLIMIT
)
348 effect
->Reverb
.DecayHFLimit
= val
;
350 alSetError(context
, AL_INVALID_VALUE
);
354 alSetError(context
, AL_INVALID_ENUM
);
358 static void eaxreverb_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
360 eaxreverb_SetParami(effect
, context
, param
, vals
[0]);
362 static void eaxreverb_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
366 case AL_EAXREVERB_DENSITY
:
367 if(val
>= AL_EAXREVERB_MIN_DENSITY
&&
368 val
<= AL_EAXREVERB_MAX_DENSITY
)
369 effect
->Reverb
.Density
= val
;
371 alSetError(context
, AL_INVALID_VALUE
);
374 case AL_EAXREVERB_DIFFUSION
:
375 if(val
>= AL_EAXREVERB_MIN_DIFFUSION
&&
376 val
<= AL_EAXREVERB_MAX_DIFFUSION
)
377 effect
->Reverb
.Diffusion
= val
;
379 alSetError(context
, AL_INVALID_VALUE
);
382 case AL_EAXREVERB_GAIN
:
383 if(val
>= AL_EAXREVERB_MIN_GAIN
&&
384 val
<= AL_EAXREVERB_MAX_GAIN
)
385 effect
->Reverb
.Gain
= val
;
387 alSetError(context
, AL_INVALID_VALUE
);
390 case AL_EAXREVERB_GAINHF
:
391 if(val
>= AL_EAXREVERB_MIN_GAINHF
&&
392 val
<= AL_EAXREVERB_MAX_GAINHF
)
393 effect
->Reverb
.GainHF
= val
;
395 alSetError(context
, AL_INVALID_VALUE
);
398 case AL_EAXREVERB_GAINLF
:
399 if(val
>= AL_EAXREVERB_MIN_GAINLF
&&
400 val
<= AL_EAXREVERB_MAX_GAINLF
)
401 effect
->Reverb
.GainLF
= val
;
403 alSetError(context
, AL_INVALID_VALUE
);
406 case AL_EAXREVERB_DECAY_TIME
:
407 if(val
>= AL_EAXREVERB_MIN_DECAY_TIME
&&
408 val
<= AL_EAXREVERB_MAX_DECAY_TIME
)
409 effect
->Reverb
.DecayTime
= val
;
411 alSetError(context
, AL_INVALID_VALUE
);
414 case AL_EAXREVERB_DECAY_HFRATIO
:
415 if(val
>= AL_EAXREVERB_MIN_DECAY_HFRATIO
&&
416 val
<= AL_EAXREVERB_MAX_DECAY_HFRATIO
)
417 effect
->Reverb
.DecayHFRatio
= val
;
419 alSetError(context
, AL_INVALID_VALUE
);
422 case AL_EAXREVERB_DECAY_LFRATIO
:
423 if(val
>= AL_EAXREVERB_MIN_DECAY_LFRATIO
&&
424 val
<= AL_EAXREVERB_MAX_DECAY_LFRATIO
)
425 effect
->Reverb
.DecayLFRatio
= val
;
427 alSetError(context
, AL_INVALID_VALUE
);
430 case AL_EAXREVERB_REFLECTIONS_GAIN
:
431 if(val
>= AL_EAXREVERB_MIN_REFLECTIONS_GAIN
&&
432 val
<= AL_EAXREVERB_MAX_REFLECTIONS_GAIN
)
433 effect
->Reverb
.ReflectionsGain
= val
;
435 alSetError(context
, AL_INVALID_VALUE
);
438 case AL_EAXREVERB_REFLECTIONS_DELAY
:
439 if(val
>= AL_EAXREVERB_MIN_REFLECTIONS_DELAY
&&
440 val
<= AL_EAXREVERB_MAX_REFLECTIONS_DELAY
)
441 effect
->Reverb
.ReflectionsDelay
= val
;
443 alSetError(context
, AL_INVALID_VALUE
);
446 case AL_EAXREVERB_LATE_REVERB_GAIN
:
447 if(val
>= AL_EAXREVERB_MIN_LATE_REVERB_GAIN
&&
448 val
<= AL_EAXREVERB_MAX_LATE_REVERB_GAIN
)
449 effect
->Reverb
.LateReverbGain
= val
;
451 alSetError(context
, AL_INVALID_VALUE
);
454 case AL_EAXREVERB_LATE_REVERB_DELAY
:
455 if(val
>= AL_EAXREVERB_MIN_LATE_REVERB_DELAY
&&
456 val
<= AL_EAXREVERB_MAX_LATE_REVERB_DELAY
)
457 effect
->Reverb
.LateReverbDelay
= val
;
459 alSetError(context
, AL_INVALID_VALUE
);
462 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF
:
463 if(val
>= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF
&&
464 val
<= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF
)
465 effect
->Reverb
.AirAbsorptionGainHF
= val
;
467 alSetError(context
, AL_INVALID_VALUE
);
470 case AL_EAXREVERB_ECHO_TIME
:
471 if(val
>= AL_EAXREVERB_MIN_ECHO_TIME
&&
472 val
<= AL_EAXREVERB_MAX_ECHO_TIME
)
473 effect
->Reverb
.EchoTime
= val
;
475 alSetError(context
, AL_INVALID_VALUE
);
478 case AL_EAXREVERB_ECHO_DEPTH
:
479 if(val
>= AL_EAXREVERB_MIN_ECHO_DEPTH
&&
480 val
<= AL_EAXREVERB_MAX_ECHO_DEPTH
)
481 effect
->Reverb
.EchoDepth
= val
;
483 alSetError(context
, AL_INVALID_VALUE
);
486 case AL_EAXREVERB_MODULATION_TIME
:
487 if(val
>= AL_EAXREVERB_MIN_MODULATION_TIME
&&
488 val
<= AL_EAXREVERB_MAX_MODULATION_TIME
)
489 effect
->Reverb
.ModulationTime
= val
;
491 alSetError(context
, AL_INVALID_VALUE
);
494 case AL_EAXREVERB_MODULATION_DEPTH
:
495 if(val
>= AL_EAXREVERB_MIN_MODULATION_DEPTH
&&
496 val
<= AL_EAXREVERB_MAX_MODULATION_DEPTH
)
497 effect
->Reverb
.ModulationDepth
= val
;
499 alSetError(context
, AL_INVALID_VALUE
);
502 case AL_EAXREVERB_HFREFERENCE
:
503 if(val
>= AL_EAXREVERB_MIN_HFREFERENCE
&&
504 val
<= AL_EAXREVERB_MAX_HFREFERENCE
)
505 effect
->Reverb
.HFReference
= val
;
507 alSetError(context
, AL_INVALID_VALUE
);
510 case AL_EAXREVERB_LFREFERENCE
:
511 if(val
>= AL_EAXREVERB_MIN_LFREFERENCE
&&
512 val
<= AL_EAXREVERB_MAX_LFREFERENCE
)
513 effect
->Reverb
.LFReference
= val
;
515 alSetError(context
, AL_INVALID_VALUE
);
518 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR
:
519 if(val
>= 0.0f
&& val
<= 10.0f
)
520 effect
->Reverb
.RoomRolloffFactor
= val
;
522 alSetError(context
, AL_INVALID_VALUE
);
526 alSetError(context
, AL_INVALID_ENUM
);
530 static void eaxreverb_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
534 case AL_EAXREVERB_REFLECTIONS_PAN
:
535 if(isfinite(vals
[0]) && isfinite(vals
[1]) && isfinite(vals
[2]))
537 LockContext(context
);
538 effect
->Reverb
.ReflectionsPan
[0] = vals
[0];
539 effect
->Reverb
.ReflectionsPan
[1] = vals
[1];
540 effect
->Reverb
.ReflectionsPan
[2] = vals
[2];
541 UnlockContext(context
);
544 alSetError(context
, AL_INVALID_VALUE
);
546 case AL_EAXREVERB_LATE_REVERB_PAN
:
547 if(isfinite(vals
[0]) && isfinite(vals
[1]) && isfinite(vals
[2]))
549 LockContext(context
);
550 effect
->Reverb
.LateReverbPan
[0] = vals
[0];
551 effect
->Reverb
.LateReverbPan
[1] = vals
[1];
552 effect
->Reverb
.LateReverbPan
[2] = vals
[2];
553 UnlockContext(context
);
556 alSetError(context
, AL_INVALID_VALUE
);
560 eaxreverb_SetParamf(effect
, context
, param
, vals
[0]);
565 static void eaxreverb_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
569 case AL_EAXREVERB_DECAY_HFLIMIT
:
570 *val
= effect
->Reverb
.DecayHFLimit
;
574 alSetError(context
, AL_INVALID_ENUM
);
578 static void eaxreverb_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
580 eaxreverb_GetParami(effect
, context
, param
, vals
);
582 static void eaxreverb_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
586 case AL_EAXREVERB_DENSITY
:
587 *val
= effect
->Reverb
.Density
;
590 case AL_EAXREVERB_DIFFUSION
:
591 *val
= effect
->Reverb
.Diffusion
;
594 case AL_EAXREVERB_GAIN
:
595 *val
= effect
->Reverb
.Gain
;
598 case AL_EAXREVERB_GAINHF
:
599 *val
= effect
->Reverb
.GainHF
;
602 case AL_EAXREVERB_GAINLF
:
603 *val
= effect
->Reverb
.GainLF
;
606 case AL_EAXREVERB_DECAY_TIME
:
607 *val
= effect
->Reverb
.DecayTime
;
610 case AL_EAXREVERB_DECAY_HFRATIO
:
611 *val
= effect
->Reverb
.DecayHFRatio
;
614 case AL_EAXREVERB_DECAY_LFRATIO
:
615 *val
= effect
->Reverb
.DecayLFRatio
;
618 case AL_EAXREVERB_REFLECTIONS_GAIN
:
619 *val
= effect
->Reverb
.ReflectionsGain
;
622 case AL_EAXREVERB_REFLECTIONS_DELAY
:
623 *val
= effect
->Reverb
.ReflectionsDelay
;
626 case AL_EAXREVERB_LATE_REVERB_GAIN
:
627 *val
= effect
->Reverb
.LateReverbGain
;
630 case AL_EAXREVERB_LATE_REVERB_DELAY
:
631 *val
= effect
->Reverb
.LateReverbDelay
;
634 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF
:
635 *val
= effect
->Reverb
.AirAbsorptionGainHF
;
638 case AL_EAXREVERB_ECHO_TIME
:
639 *val
= effect
->Reverb
.EchoTime
;
642 case AL_EAXREVERB_ECHO_DEPTH
:
643 *val
= effect
->Reverb
.EchoDepth
;
646 case AL_EAXREVERB_MODULATION_TIME
:
647 *val
= effect
->Reverb
.ModulationTime
;
650 case AL_EAXREVERB_MODULATION_DEPTH
:
651 *val
= effect
->Reverb
.ModulationDepth
;
654 case AL_EAXREVERB_HFREFERENCE
:
655 *val
= effect
->Reverb
.HFReference
;
658 case AL_EAXREVERB_LFREFERENCE
:
659 *val
= effect
->Reverb
.LFReference
;
662 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR
:
663 *val
= effect
->Reverb
.RoomRolloffFactor
;
667 alSetError(context
, AL_INVALID_ENUM
);
671 static void eaxreverb_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
675 case AL_EAXREVERB_REFLECTIONS_PAN
:
676 LockContext(context
);
677 vals
[0] = effect
->Reverb
.ReflectionsPan
[0];
678 vals
[1] = effect
->Reverb
.ReflectionsPan
[1];
679 vals
[2] = effect
->Reverb
.ReflectionsPan
[2];
680 UnlockContext(context
);
682 case AL_EAXREVERB_LATE_REVERB_PAN
:
683 LockContext(context
);
684 vals
[0] = effect
->Reverb
.LateReverbPan
[0];
685 vals
[1] = effect
->Reverb
.LateReverbPan
[1];
686 vals
[2] = effect
->Reverb
.LateReverbPan
[2];
687 UnlockContext(context
);
691 eaxreverb_GetParamf(effect
, context
, param
, vals
);
697 static void reverb_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
701 case AL_REVERB_DECAY_HFLIMIT
:
702 if(val
>= AL_REVERB_MIN_DECAY_HFLIMIT
&&
703 val
<= AL_REVERB_MAX_DECAY_HFLIMIT
)
704 effect
->Reverb
.DecayHFLimit
= val
;
706 alSetError(context
, AL_INVALID_VALUE
);
710 alSetError(context
, AL_INVALID_ENUM
);
714 static void reverb_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
716 reverb_SetParami(effect
, context
, param
, vals
[0]);
718 static void reverb_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
722 case AL_REVERB_DENSITY
:
723 if(val
>= AL_REVERB_MIN_DENSITY
&&
724 val
<= AL_REVERB_MAX_DENSITY
)
725 effect
->Reverb
.Density
= val
;
727 alSetError(context
, AL_INVALID_VALUE
);
730 case AL_REVERB_DIFFUSION
:
731 if(val
>= AL_REVERB_MIN_DIFFUSION
&&
732 val
<= AL_REVERB_MAX_DIFFUSION
)
733 effect
->Reverb
.Diffusion
= val
;
735 alSetError(context
, AL_INVALID_VALUE
);
739 if(val
>= AL_REVERB_MIN_GAIN
&&
740 val
<= AL_REVERB_MAX_GAIN
)
741 effect
->Reverb
.Gain
= val
;
743 alSetError(context
, AL_INVALID_VALUE
);
746 case AL_REVERB_GAINHF
:
747 if(val
>= AL_REVERB_MIN_GAINHF
&&
748 val
<= AL_REVERB_MAX_GAINHF
)
749 effect
->Reverb
.GainHF
= val
;
751 alSetError(context
, AL_INVALID_VALUE
);
754 case AL_REVERB_DECAY_TIME
:
755 if(val
>= AL_REVERB_MIN_DECAY_TIME
&&
756 val
<= AL_REVERB_MAX_DECAY_TIME
)
757 effect
->Reverb
.DecayTime
= val
;
759 alSetError(context
, AL_INVALID_VALUE
);
762 case AL_REVERB_DECAY_HFRATIO
:
763 if(val
>= AL_REVERB_MIN_DECAY_HFRATIO
&&
764 val
<= AL_REVERB_MAX_DECAY_HFRATIO
)
765 effect
->Reverb
.DecayHFRatio
= val
;
767 alSetError(context
, AL_INVALID_VALUE
);
770 case AL_REVERB_REFLECTIONS_GAIN
:
771 if(val
>= AL_REVERB_MIN_REFLECTIONS_GAIN
&&
772 val
<= AL_REVERB_MAX_REFLECTIONS_GAIN
)
773 effect
->Reverb
.ReflectionsGain
= val
;
775 alSetError(context
, AL_INVALID_VALUE
);
778 case AL_REVERB_REFLECTIONS_DELAY
:
779 if(val
>= AL_REVERB_MIN_REFLECTIONS_DELAY
&&
780 val
<= AL_REVERB_MAX_REFLECTIONS_DELAY
)
781 effect
->Reverb
.ReflectionsDelay
= val
;
783 alSetError(context
, AL_INVALID_VALUE
);
786 case AL_REVERB_LATE_REVERB_GAIN
:
787 if(val
>= AL_REVERB_MIN_LATE_REVERB_GAIN
&&
788 val
<= AL_REVERB_MAX_LATE_REVERB_GAIN
)
789 effect
->Reverb
.LateReverbGain
= val
;
791 alSetError(context
, AL_INVALID_VALUE
);
794 case AL_REVERB_LATE_REVERB_DELAY
:
795 if(val
>= AL_REVERB_MIN_LATE_REVERB_DELAY
&&
796 val
<= AL_REVERB_MAX_LATE_REVERB_DELAY
)
797 effect
->Reverb
.LateReverbDelay
= val
;
799 alSetError(context
, AL_INVALID_VALUE
);
802 case AL_REVERB_AIR_ABSORPTION_GAINHF
:
803 if(val
>= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF
&&
804 val
<= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF
)
805 effect
->Reverb
.AirAbsorptionGainHF
= val
;
807 alSetError(context
, AL_INVALID_VALUE
);
810 case AL_REVERB_ROOM_ROLLOFF_FACTOR
:
811 if(val
>= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR
&&
812 val
<= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR
)
813 effect
->Reverb
.RoomRolloffFactor
= val
;
815 alSetError(context
, AL_INVALID_VALUE
);
819 alSetError(context
, AL_INVALID_ENUM
);
823 static void reverb_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
825 reverb_SetParamf(effect
, context
, param
, vals
[0]);
828 static void reverb_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
832 case AL_REVERB_DECAY_HFLIMIT
:
833 *val
= effect
->Reverb
.DecayHFLimit
;
837 alSetError(context
, AL_INVALID_ENUM
);
841 static void reverb_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
843 reverb_GetParami(effect
, context
, param
, vals
);
845 static void reverb_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
849 case AL_REVERB_DENSITY
:
850 *val
= effect
->Reverb
.Density
;
853 case AL_REVERB_DIFFUSION
:
854 *val
= effect
->Reverb
.Diffusion
;
858 *val
= effect
->Reverb
.Gain
;
861 case AL_REVERB_GAINHF
:
862 *val
= effect
->Reverb
.GainHF
;
865 case AL_REVERB_DECAY_TIME
:
866 *val
= effect
->Reverb
.DecayTime
;
869 case AL_REVERB_DECAY_HFRATIO
:
870 *val
= effect
->Reverb
.DecayHFRatio
;
873 case AL_REVERB_REFLECTIONS_GAIN
:
874 *val
= effect
->Reverb
.ReflectionsGain
;
877 case AL_REVERB_REFLECTIONS_DELAY
:
878 *val
= effect
->Reverb
.ReflectionsDelay
;
881 case AL_REVERB_LATE_REVERB_GAIN
:
882 *val
= effect
->Reverb
.LateReverbGain
;
885 case AL_REVERB_LATE_REVERB_DELAY
:
886 *val
= effect
->Reverb
.LateReverbDelay
;
889 case AL_REVERB_AIR_ABSORPTION_GAINHF
:
890 *val
= effect
->Reverb
.AirAbsorptionGainHF
;
893 case AL_REVERB_ROOM_ROLLOFF_FACTOR
:
894 *val
= effect
->Reverb
.RoomRolloffFactor
;
898 alSetError(context
, AL_INVALID_ENUM
);
902 static void reverb_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
904 reverb_GetParamf(effect
, context
, param
, vals
);
908 static void echo_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
909 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
910 static void echo_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
912 echo_SetParami(effect
, context
, param
, vals
[0]);
914 static void echo_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
919 if(val
>= AL_ECHO_MIN_DELAY
&& val
<= AL_ECHO_MAX_DELAY
)
920 effect
->Echo
.Delay
= val
;
922 alSetError(context
, AL_INVALID_VALUE
);
925 case AL_ECHO_LRDELAY
:
926 if(val
>= AL_ECHO_MIN_LRDELAY
&& val
<= AL_ECHO_MAX_LRDELAY
)
927 effect
->Echo
.LRDelay
= val
;
929 alSetError(context
, AL_INVALID_VALUE
);
932 case AL_ECHO_DAMPING
:
933 if(val
>= AL_ECHO_MIN_DAMPING
&& val
<= AL_ECHO_MAX_DAMPING
)
934 effect
->Echo
.Damping
= val
;
936 alSetError(context
, AL_INVALID_VALUE
);
939 case AL_ECHO_FEEDBACK
:
940 if(val
>= AL_ECHO_MIN_FEEDBACK
&& val
<= AL_ECHO_MAX_FEEDBACK
)
941 effect
->Echo
.Feedback
= val
;
943 alSetError(context
, AL_INVALID_VALUE
);
947 if(val
>= AL_ECHO_MIN_SPREAD
&& val
<= AL_ECHO_MAX_SPREAD
)
948 effect
->Echo
.Spread
= val
;
950 alSetError(context
, AL_INVALID_VALUE
);
954 alSetError(context
, AL_INVALID_ENUM
);
958 static void echo_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
960 echo_SetParamf(effect
, context
, param
, vals
[0]);
963 static void echo_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
964 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
965 static void echo_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
967 echo_GetParami(effect
, context
, param
, vals
);
969 static void echo_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
974 *val
= effect
->Echo
.Delay
;
977 case AL_ECHO_LRDELAY
:
978 *val
= effect
->Echo
.LRDelay
;
981 case AL_ECHO_DAMPING
:
982 *val
= effect
->Echo
.Damping
;
985 case AL_ECHO_FEEDBACK
:
986 *val
= effect
->Echo
.Feedback
;
990 *val
= effect
->Echo
.Spread
;
994 alSetError(context
, AL_INVALID_ENUM
);
998 static void echo_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
1000 echo_GetParamf(effect
, context
, param
, vals
);
1004 static void mod_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
1008 case AL_RING_MODULATOR_FREQUENCY
:
1009 if(val
>= AL_RING_MODULATOR_MIN_FREQUENCY
&&
1010 val
<= AL_RING_MODULATOR_MAX_FREQUENCY
)
1011 effect
->Modulator
.Frequency
= val
;
1013 alSetError(context
, AL_INVALID_VALUE
);
1016 case AL_RING_MODULATOR_HIGHPASS_CUTOFF
:
1017 if(val
>= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF
&&
1018 val
<= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF
)
1019 effect
->Modulator
.HighPassCutoff
= val
;
1021 alSetError(context
, AL_INVALID_VALUE
);
1025 alSetError(context
, AL_INVALID_ENUM
);
1029 static void mod_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
1031 mod_SetParamf(effect
, context
, param
, vals
[0]);
1033 static void mod_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
1037 case AL_RING_MODULATOR_FREQUENCY
:
1038 case AL_RING_MODULATOR_HIGHPASS_CUTOFF
:
1039 mod_SetParamf(effect
, context
, param
, (ALfloat
)val
);
1042 case AL_RING_MODULATOR_WAVEFORM
:
1043 if(val
>= AL_RING_MODULATOR_MIN_WAVEFORM
&&
1044 val
<= AL_RING_MODULATOR_MAX_WAVEFORM
)
1045 effect
->Modulator
.Waveform
= val
;
1047 alSetError(context
, AL_INVALID_VALUE
);
1051 alSetError(context
, AL_INVALID_ENUM
);
1055 static void mod_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
1057 mod_SetParami(effect
, context
, param
, vals
[0]);
1060 static void mod_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
1064 case AL_RING_MODULATOR_FREQUENCY
:
1065 *val
= (ALint
)effect
->Modulator
.Frequency
;
1067 case AL_RING_MODULATOR_HIGHPASS_CUTOFF
:
1068 *val
= (ALint
)effect
->Modulator
.HighPassCutoff
;
1070 case AL_RING_MODULATOR_WAVEFORM
:
1071 *val
= effect
->Modulator
.Waveform
;
1075 alSetError(context
, AL_INVALID_ENUM
);
1079 static void mod_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
1081 mod_GetParami(effect
, context
, param
, vals
);
1083 static void mod_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
1087 case AL_RING_MODULATOR_FREQUENCY
:
1088 *val
= effect
->Modulator
.Frequency
;
1090 case AL_RING_MODULATOR_HIGHPASS_CUTOFF
:
1091 *val
= effect
->Modulator
.HighPassCutoff
;
1095 alSetError(context
, AL_INVALID_ENUM
);
1099 static void mod_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
1101 mod_GetParamf(effect
, context
, param
, vals
);
1105 static void ded_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
1106 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1107 static void ded_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
1109 ded_SetParami(effect
, context
, param
, vals
[0]);
1111 static void ded_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
1115 case AL_DEDICATED_GAIN
:
1116 if(val
>= 0.0f
&& isfinite(val
))
1117 effect
->Dedicated
.Gain
= val
;
1119 alSetError(context
, AL_INVALID_VALUE
);
1123 alSetError(context
, AL_INVALID_ENUM
);
1127 static void ded_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
1129 ded_SetParamf(effect
, context
, param
, vals
[0]);
1132 static void ded_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
1133 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1134 static void ded_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
1136 ded_GetParami(effect
, context
, param
, vals
);
1138 static void ded_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
1142 case AL_DEDICATED_GAIN
:
1143 *val
= effect
->Dedicated
.Gain
;
1147 alSetError(context
, AL_INVALID_ENUM
);
1151 static void ded_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
1153 ded_GetParamf(effect
, context
, param
, vals
);
1157 static void null_SetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint val
)
1158 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1159 static void null_SetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALint
*vals
)
1160 { (void)effect
;(void)param
;(void)vals
; alSetError(context
, AL_INVALID_ENUM
); }
1161 static void null_SetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat val
)
1162 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1163 static void null_SetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
)
1164 { (void)effect
;(void)param
;(void)vals
; alSetError(context
, AL_INVALID_ENUM
); }
1166 static void null_GetParami(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*val
)
1167 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1168 static void null_GetParamiv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALint
*vals
)
1169 { (void)effect
;(void)param
;(void)vals
; alSetError(context
, AL_INVALID_ENUM
); }
1170 static void null_GetParamf(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*val
)
1171 { (void)effect
;(void)param
;(void)val
; alSetError(context
, AL_INVALID_ENUM
); }
1172 static void null_GetParamfv(ALeffect
*effect
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
)
1173 { (void)effect
;(void)param
;(void)vals
; alSetError(context
, AL_INVALID_ENUM
); }
1176 ALenum
InitEffect(ALeffect
*effect
)
1178 InitEffectParams(effect
, AL_EFFECT_NULL
);
1182 ALvoid
ReleaseALEffects(ALCdevice
*device
)
1185 for(i
= 0;i
< device
->EffectMap
.size
;i
++)
1187 ALeffect
*temp
= device
->EffectMap
.array
[i
].value
;
1188 device
->EffectMap
.array
[i
].value
= NULL
;
1190 // Release effect structure
1191 FreeThunkEntry(temp
->effect
);
1192 memset(temp
, 0, sizeof(ALeffect
));
1198 static void InitEffectParams(ALeffect
*effect
, ALenum type
)
1202 case AL_EFFECT_EAXREVERB
:
1203 effect
->Reverb
.Density
= AL_EAXREVERB_DEFAULT_DENSITY
;
1204 effect
->Reverb
.Diffusion
= AL_EAXREVERB_DEFAULT_DIFFUSION
;
1205 effect
->Reverb
.Gain
= AL_EAXREVERB_DEFAULT_GAIN
;
1206 effect
->Reverb
.GainHF
= AL_EAXREVERB_DEFAULT_GAINHF
;
1207 effect
->Reverb
.GainLF
= AL_EAXREVERB_DEFAULT_GAINLF
;
1208 effect
->Reverb
.DecayTime
= AL_EAXREVERB_DEFAULT_DECAY_TIME
;
1209 effect
->Reverb
.DecayHFRatio
= AL_EAXREVERB_DEFAULT_DECAY_HFRATIO
;
1210 effect
->Reverb
.DecayLFRatio
= AL_EAXREVERB_DEFAULT_DECAY_LFRATIO
;
1211 effect
->Reverb
.ReflectionsGain
= AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN
;
1212 effect
->Reverb
.ReflectionsDelay
= AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY
;
1213 effect
->Reverb
.ReflectionsPan
[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ
;
1214 effect
->Reverb
.ReflectionsPan
[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ
;
1215 effect
->Reverb
.ReflectionsPan
[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ
;
1216 effect
->Reverb
.LateReverbGain
= AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN
;
1217 effect
->Reverb
.LateReverbDelay
= AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY
;
1218 effect
->Reverb
.LateReverbPan
[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ
;
1219 effect
->Reverb
.LateReverbPan
[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ
;
1220 effect
->Reverb
.LateReverbPan
[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ
;
1221 effect
->Reverb
.EchoTime
= AL_EAXREVERB_DEFAULT_ECHO_TIME
;
1222 effect
->Reverb
.EchoDepth
= AL_EAXREVERB_DEFAULT_ECHO_DEPTH
;
1223 effect
->Reverb
.ModulationTime
= AL_EAXREVERB_DEFAULT_MODULATION_TIME
;
1224 effect
->Reverb
.ModulationDepth
= AL_EAXREVERB_DEFAULT_MODULATION_DEPTH
;
1225 effect
->Reverb
.AirAbsorptionGainHF
= AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF
;
1226 effect
->Reverb
.HFReference
= AL_EAXREVERB_DEFAULT_HFREFERENCE
;
1227 effect
->Reverb
.LFReference
= AL_EAXREVERB_DEFAULT_LFREFERENCE
;
1228 effect
->Reverb
.RoomRolloffFactor
= AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR
;
1229 effect
->Reverb
.DecayHFLimit
= AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT
;
1230 effect
->SetParami
= eaxreverb_SetParami
;
1231 effect
->SetParamiv
= eaxreverb_SetParamiv
;
1232 effect
->SetParamf
= eaxreverb_SetParamf
;
1233 effect
->SetParamfv
= eaxreverb_SetParamfv
;
1234 effect
->GetParami
= eaxreverb_GetParami
;
1235 effect
->GetParamiv
= eaxreverb_GetParamiv
;
1236 effect
->GetParamf
= eaxreverb_GetParamf
;
1237 effect
->GetParamfv
= eaxreverb_GetParamfv
;
1239 case AL_EFFECT_REVERB
:
1240 effect
->Reverb
.Density
= AL_REVERB_DEFAULT_DENSITY
;
1241 effect
->Reverb
.Diffusion
= AL_REVERB_DEFAULT_DIFFUSION
;
1242 effect
->Reverb
.Gain
= AL_REVERB_DEFAULT_GAIN
;
1243 effect
->Reverb
.GainHF
= AL_REVERB_DEFAULT_GAINHF
;
1244 effect
->Reverb
.DecayTime
= AL_REVERB_DEFAULT_DECAY_TIME
;
1245 effect
->Reverb
.DecayHFRatio
= AL_REVERB_DEFAULT_DECAY_HFRATIO
;
1246 effect
->Reverb
.ReflectionsGain
= AL_REVERB_DEFAULT_REFLECTIONS_GAIN
;
1247 effect
->Reverb
.ReflectionsDelay
= AL_REVERB_DEFAULT_REFLECTIONS_DELAY
;
1248 effect
->Reverb
.LateReverbGain
= AL_REVERB_DEFAULT_LATE_REVERB_GAIN
;
1249 effect
->Reverb
.LateReverbDelay
= AL_REVERB_DEFAULT_LATE_REVERB_DELAY
;
1250 effect
->Reverb
.AirAbsorptionGainHF
= AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF
;
1251 effect
->Reverb
.RoomRolloffFactor
= AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR
;
1252 effect
->Reverb
.DecayHFLimit
= AL_REVERB_DEFAULT_DECAY_HFLIMIT
;
1253 effect
->SetParami
= reverb_SetParami
;
1254 effect
->SetParamiv
= reverb_SetParamiv
;
1255 effect
->SetParamf
= reverb_SetParamf
;
1256 effect
->SetParamfv
= reverb_SetParamfv
;
1257 effect
->GetParami
= reverb_GetParami
;
1258 effect
->GetParamiv
= reverb_GetParamiv
;
1259 effect
->GetParamf
= reverb_GetParamf
;
1260 effect
->GetParamfv
= reverb_GetParamfv
;
1262 case AL_EFFECT_ECHO
:
1263 effect
->Echo
.Delay
= AL_ECHO_DEFAULT_DELAY
;
1264 effect
->Echo
.LRDelay
= AL_ECHO_DEFAULT_LRDELAY
;
1265 effect
->Echo
.Damping
= AL_ECHO_DEFAULT_DAMPING
;
1266 effect
->Echo
.Feedback
= AL_ECHO_DEFAULT_FEEDBACK
;
1267 effect
->Echo
.Spread
= AL_ECHO_DEFAULT_SPREAD
;
1268 effect
->SetParami
= echo_SetParami
;
1269 effect
->SetParamiv
= echo_SetParamiv
;
1270 effect
->SetParamf
= echo_SetParamf
;
1271 effect
->SetParamfv
= echo_SetParamfv
;
1272 effect
->GetParami
= echo_GetParami
;
1273 effect
->GetParamiv
= echo_GetParamiv
;
1274 effect
->GetParamf
= echo_GetParamf
;
1275 effect
->GetParamfv
= echo_GetParamfv
;
1277 case AL_EFFECT_RING_MODULATOR
:
1278 effect
->Modulator
.Frequency
= AL_RING_MODULATOR_DEFAULT_FREQUENCY
;
1279 effect
->Modulator
.HighPassCutoff
= AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF
;
1280 effect
->Modulator
.Waveform
= AL_RING_MODULATOR_DEFAULT_WAVEFORM
;
1281 effect
->SetParami
= mod_SetParami
;
1282 effect
->SetParamiv
= mod_SetParamiv
;
1283 effect
->SetParamf
= mod_SetParamf
;
1284 effect
->SetParamfv
= mod_SetParamfv
;
1285 effect
->GetParami
= mod_GetParami
;
1286 effect
->GetParamiv
= mod_GetParamiv
;
1287 effect
->GetParamf
= mod_GetParamf
;
1288 effect
->GetParamfv
= mod_GetParamfv
;
1290 case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT
:
1291 case AL_EFFECT_DEDICATED_DIALOGUE
:
1292 effect
->Dedicated
.Gain
= 1.0f
;
1293 effect
->SetParami
= ded_SetParami
;
1294 effect
->SetParamiv
= ded_SetParamiv
;
1295 effect
->SetParamf
= ded_SetParamf
;
1296 effect
->SetParamfv
= ded_SetParamfv
;
1297 effect
->GetParami
= ded_GetParami
;
1298 effect
->GetParamiv
= ded_GetParamiv
;
1299 effect
->GetParamf
= ded_GetParamf
;
1300 effect
->GetParamfv
= ded_GetParamfv
;
1303 effect
->SetParami
= null_SetParami
;
1304 effect
->SetParamiv
= null_SetParamiv
;
1305 effect
->SetParamf
= null_SetParamf
;
1306 effect
->SetParamfv
= null_SetParamfv
;
1307 effect
->GetParami
= null_GetParami
;
1308 effect
->GetParamiv
= null_GetParamiv
;
1309 effect
->GetParamf
= null_GetParamf
;
1310 effect
->GetParamfv
= null_GetParamfv
;
1313 effect
->type
= type
;
1317 #include "AL/efx-presets.h"
1319 #define DECL(x) { #x, EFX_REVERB_PRESET_##x }
1320 static const struct {
1321 const char name
[32];
1322 EFXEAXREVERBPROPERTIES props
;
1335 DECL(CARPETTEDHALLWAY
),
1337 DECL(STONECORRIDOR
),
1351 DECL(CASTLE_SMALLROOM
),
1352 DECL(CASTLE_SHORTPASSAGE
),
1353 DECL(CASTLE_MEDIUMROOM
),
1354 DECL(CASTLE_LARGEROOM
),
1355 DECL(CASTLE_LONGPASSAGE
),
1357 DECL(CASTLE_CUPBOARD
),
1358 DECL(CASTLE_COURTYARD
),
1359 DECL(CASTLE_ALCOVE
),
1361 DECL(FACTORY_SMALLROOM
),
1362 DECL(FACTORY_SHORTPASSAGE
),
1363 DECL(FACTORY_MEDIUMROOM
),
1364 DECL(FACTORY_LARGEROOM
),
1365 DECL(FACTORY_LONGPASSAGE
),
1367 DECL(FACTORY_CUPBOARD
),
1368 DECL(FACTORY_COURTYARD
),
1369 DECL(FACTORY_ALCOVE
),
1371 DECL(ICEPALACE_SMALLROOM
),
1372 DECL(ICEPALACE_SHORTPASSAGE
),
1373 DECL(ICEPALACE_MEDIUMROOM
),
1374 DECL(ICEPALACE_LARGEROOM
),
1375 DECL(ICEPALACE_LONGPASSAGE
),
1376 DECL(ICEPALACE_HALL
),
1377 DECL(ICEPALACE_CUPBOARD
),
1378 DECL(ICEPALACE_COURTYARD
),
1379 DECL(ICEPALACE_ALCOVE
),
1381 DECL(SPACESTATION_SMALLROOM
),
1382 DECL(SPACESTATION_SHORTPASSAGE
),
1383 DECL(SPACESTATION_MEDIUMROOM
),
1384 DECL(SPACESTATION_LARGEROOM
),
1385 DECL(SPACESTATION_LONGPASSAGE
),
1386 DECL(SPACESTATION_HALL
),
1387 DECL(SPACESTATION_CUPBOARD
),
1388 DECL(SPACESTATION_ALCOVE
),
1390 DECL(WOODEN_SMALLROOM
),
1391 DECL(WOODEN_SHORTPASSAGE
),
1392 DECL(WOODEN_MEDIUMROOM
),
1393 DECL(WOODEN_LARGEROOM
),
1394 DECL(WOODEN_LONGPASSAGE
),
1396 DECL(WOODEN_CUPBOARD
),
1397 DECL(WOODEN_COURTYARD
),
1398 DECL(WOODEN_ALCOVE
),
1400 DECL(SPORT_EMPTYSTADIUM
),
1401 DECL(SPORT_SQUASHCOURT
),
1402 DECL(SPORT_SMALLSWIMMINGPOOL
),
1403 DECL(SPORT_LARGESWIMMINGPOOL
),
1404 DECL(SPORT_GYMNASIUM
),
1405 DECL(SPORT_FULLSTADIUM
),
1406 DECL(SPORT_STADIUMTANNOY
),
1408 DECL(PREFAB_WORKSHOP
),
1409 DECL(PREFAB_SCHOOLROOM
),
1410 DECL(PREFAB_PRACTISEROOM
),
1411 DECL(PREFAB_OUTHOUSE
),
1412 DECL(PREFAB_CARAVAN
),
1416 DECL(DOME_SAINTPAULS
),
1417 DECL(PIPE_LONGTHIN
),
1419 DECL(PIPE_RESONANT
),
1421 DECL(OUTDOORS_BACKYARD
),
1422 DECL(OUTDOORS_ROLLINGPLAINS
),
1423 DECL(OUTDOORS_DEEPCANYON
),
1424 DECL(OUTDOORS_CREEK
),
1425 DECL(OUTDOORS_VALLEY
),
1431 DECL(DRIVING_COMMENTATOR
),
1432 DECL(DRIVING_PITGARAGE
),
1433 DECL(DRIVING_INCAR_RACER
),
1434 DECL(DRIVING_INCAR_SPORTS
),
1435 DECL(DRIVING_INCAR_LUXURY
),
1436 DECL(DRIVING_FULLGRANDSTAND
),
1437 DECL(DRIVING_EMPTYGRANDSTAND
),
1438 DECL(DRIVING_TUNNEL
),
1444 DECL(CITY_UNDERPASS
),
1445 DECL(CITY_ABANDONED
),
1449 DECL(SMALLWATERROOM
),
1452 static const ALsizei reverblistsize
= sizeof(reverblist
)/sizeof(reverblist
[0]);
1454 ALvoid
GetReverbEffect(const char *name
, ALeffect
*effect
)
1458 if(!DisabledEffects
[EAXREVERB
])
1459 InitEffectParams(effect
, AL_EFFECT_EAXREVERB
);
1460 else if(!DisabledEffects
[REVERB
])
1461 InitEffectParams(effect
, AL_EFFECT_REVERB
);
1463 InitEffectParams(effect
, AL_EFFECT_NULL
);
1464 for(i
= 0;i
< reverblistsize
;i
++)
1466 const EFXEAXREVERBPROPERTIES
*props
;
1468 if(strcasecmp(name
, reverblist
[i
].name
) != 0)
1471 TRACE("Loading reverb '%s'\n", reverblist
[i
].name
);
1472 props
= &reverblist
[i
].props
;
1473 effect
->Reverb
.Density
= props
->flDensity
;
1474 effect
->Reverb
.Diffusion
= props
->flDiffusion
;
1475 effect
->Reverb
.Gain
= props
->flGain
;
1476 effect
->Reverb
.GainHF
= props
->flGainHF
;
1477 effect
->Reverb
.GainLF
= props
->flGainLF
;
1478 effect
->Reverb
.DecayTime
= props
->flDecayTime
;
1479 effect
->Reverb
.DecayHFRatio
= props
->flDecayHFRatio
;
1480 effect
->Reverb
.DecayLFRatio
= props
->flDecayLFRatio
;
1481 effect
->Reverb
.ReflectionsGain
= props
->flReflectionsGain
;
1482 effect
->Reverb
.ReflectionsDelay
= props
->flReflectionsDelay
;
1483 effect
->Reverb
.ReflectionsPan
[0] = props
->flReflectionsPan
[0];
1484 effect
->Reverb
.ReflectionsPan
[1] = props
->flReflectionsPan
[1];
1485 effect
->Reverb
.ReflectionsPan
[2] = props
->flReflectionsPan
[2];
1486 effect
->Reverb
.LateReverbGain
= props
->flLateReverbGain
;
1487 effect
->Reverb
.LateReverbDelay
= props
->flLateReverbDelay
;
1488 effect
->Reverb
.LateReverbPan
[0] = props
->flLateReverbPan
[0];
1489 effect
->Reverb
.LateReverbPan
[1] = props
->flLateReverbPan
[1];
1490 effect
->Reverb
.LateReverbPan
[2] = props
->flLateReverbPan
[2];
1491 effect
->Reverb
.EchoTime
= props
->flEchoTime
;
1492 effect
->Reverb
.EchoDepth
= props
->flEchoDepth
;
1493 effect
->Reverb
.ModulationTime
= props
->flModulationTime
;
1494 effect
->Reverb
.ModulationDepth
= props
->flModulationDepth
;
1495 effect
->Reverb
.AirAbsorptionGainHF
= props
->flAirAbsorptionGainHF
;
1496 effect
->Reverb
.HFReference
= props
->flHFReference
;
1497 effect
->Reverb
.LFReference
= props
->flLFReference
;
1498 effect
->Reverb
.RoomRolloffFactor
= props
->flRoomRolloffFactor
;
1499 effect
->Reverb
.DecayHFLimit
= props
->iDecayHFLimit
;
1502 if(i
== reverblistsize
)
1503 WARN("Reverb preset '%s' not found\n", name
);