Check the number of available samples before calling the capture method
[openal-soft/android.git] / OpenAL32 / alEffect.c
blobe952e6b687ea29143bf64e110367b6c9212e25fc
1 /**
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
21 #include "config.h"
23 #include <stdlib.h>
24 #include <math.h>
26 #include "AL/al.h"
27 #include "AL/alc.h"
28 #include "alMain.h"
29 #include "alEffect.h"
30 #include "alThunk.h"
31 #include "alError.h"
34 ALboolean DisabledEffects[MAX_EFFECTS];
37 static void InitEffectParams(ALeffect *effect, ALenum type);
39 #define LookupEffect(m, k) ((ALeffect*)LookupUIntMapKey(&(m), (k)))
40 #define RemoveEffect(m, k) ((ALeffect*)PopUIntMapValue(&(m), (k)))
42 AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
44 ALCcontext *Context;
45 ALsizei i;
47 Context = GetContextRef();
48 if(!Context) return;
50 if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
51 alSetError(Context, AL_INVALID_VALUE);
52 else
54 ALCdevice *device = Context->Device;
55 ALenum err;
57 for(i = 0;i < n;i++)
59 ALeffect *effect = calloc(1, sizeof(ALeffect));
60 if(!effect)
62 alSetError(Context, AL_OUT_OF_MEMORY);
63 alDeleteEffects(i, effects);
64 break;
66 InitEffectParams(effect, AL_EFFECT_NULL);
68 err = NewThunkEntry(&effect->effect);
69 if(err == AL_NO_ERROR)
70 err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect);
71 if(err != AL_NO_ERROR)
73 FreeThunkEntry(effect->effect);
74 memset(effect, 0, sizeof(ALeffect));
75 free(effect);
77 alSetError(Context, err);
78 alDeleteEffects(i, effects);
79 break;
82 effects[i] = effect->effect;
86 ALCcontext_DecRef(Context);
89 AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects)
91 ALCcontext *Context;
92 ALCdevice *device;
93 ALeffect *ALEffect;
94 ALsizei i;
96 Context = GetContextRef();
97 if(!Context) return;
99 device = Context->Device;
100 if(n < 0)
101 alSetError(Context, AL_INVALID_VALUE);
102 else
104 // Check that all effects are valid
105 for(i = 0;i < n;i++)
107 if(!effects[i])
108 continue;
110 if(LookupEffect(device->EffectMap, effects[i]) == NULL)
112 alSetError(Context, AL_INVALID_NAME);
113 n = 0;
114 break;
118 for(i = 0;i < n;i++)
120 // Recheck that the effect is valid, because there could be duplicated names
121 if((ALEffect=RemoveEffect(device->EffectMap, effects[i])) == NULL)
122 continue;
123 FreeThunkEntry(ALEffect->effect);
125 memset(ALEffect, 0, sizeof(ALeffect));
126 free(ALEffect);
130 ALCcontext_DecRef(Context);
133 AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
135 ALCcontext *Context;
136 ALboolean result;
138 Context = GetContextRef();
139 if(!Context) return AL_FALSE;
141 result = ((!effect || LookupEffect(Context->Device->EffectMap, effect)) ?
142 AL_TRUE : AL_FALSE);
144 ALCcontext_DecRef(Context);
146 return result;
149 AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
151 ALCcontext *Context;
152 ALCdevice *Device;
153 ALeffect *ALEffect;
155 Context = GetContextRef();
156 if(!Context) return;
158 Device = Context->Device;
159 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
161 if(param == AL_EFFECT_TYPE)
163 ALboolean isOk = (iValue == AL_EFFECT_NULL);
164 ALint i;
165 for(i = 0;!isOk && EffectList[i].val;i++)
167 if(iValue == EffectList[i].val &&
168 !DisabledEffects[EffectList[i].type])
169 isOk = AL_TRUE;
172 if(isOk)
173 InitEffectParams(ALEffect, iValue);
174 else
175 alSetError(Context, AL_INVALID_VALUE);
177 else
179 /* Call the appropriate handler */
180 ALeffect_SetParami(ALEffect, Context, param, iValue);
183 else
184 alSetError(Context, AL_INVALID_NAME);
186 ALCcontext_DecRef(Context);
189 AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues)
191 ALCcontext *Context;
192 ALCdevice *Device;
193 ALeffect *ALEffect;
195 Context = GetContextRef();
196 if(!Context) return;
198 Device = Context->Device;
199 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
201 /* Call the appropriate handler */
202 ALeffect_SetParamiv(ALEffect, Context, param, piValues);
204 else
205 alSetError(Context, AL_INVALID_NAME);
207 ALCcontext_DecRef(Context);
210 AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue)
212 ALCcontext *Context;
213 ALCdevice *Device;
214 ALeffect *ALEffect;
216 Context = GetContextRef();
217 if(!Context) return;
219 Device = Context->Device;
220 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
222 /* Call the appropriate handler */
223 ALeffect_SetParamf(ALEffect, Context, param, flValue);
225 else
226 alSetError(Context, AL_INVALID_NAME);
228 ALCcontext_DecRef(Context);
231 AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
233 ALCcontext *Context;
234 ALCdevice *Device;
235 ALeffect *ALEffect;
237 Context = GetContextRef();
238 if(!Context) return;
240 Device = Context->Device;
241 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
243 /* Call the appropriate handler */
244 ALeffect_SetParamfv(ALEffect, Context, param, pflValues);
246 else
247 alSetError(Context, AL_INVALID_NAME);
249 ALCcontext_DecRef(Context);
252 AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue)
254 ALCcontext *Context;
255 ALCdevice *Device;
256 ALeffect *ALEffect;
258 Context = GetContextRef();
259 if(!Context) return;
261 Device = Context->Device;
262 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
264 if(param == AL_EFFECT_TYPE)
266 *piValue = ALEffect->type;
268 else
270 /* Call the appropriate handler */
271 ALeffect_GetParamiv(ALEffect, Context, param, piValue);
274 else
275 alSetError(Context, AL_INVALID_NAME);
277 ALCcontext_DecRef(Context);
280 AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues)
282 ALCcontext *Context;
283 ALCdevice *Device;
284 ALeffect *ALEffect;
286 Context = GetContextRef();
287 if(!Context) return;
289 Device = Context->Device;
290 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
292 /* Call the appropriate handler */
293 ALeffect_GetParamiv(ALEffect, Context, param, piValues);
295 else
296 alSetError(Context, AL_INVALID_NAME);
298 ALCcontext_DecRef(Context);
301 AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue)
303 ALCcontext *Context;
304 ALCdevice *Device;
305 ALeffect *ALEffect;
307 Context = GetContextRef();
308 if(!Context) return;
310 Device = Context->Device;
311 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
313 /* Call the appropriate handler */
314 ALeffect_GetParamf(ALEffect, Context, param, pflValue);
316 else
317 alSetError(Context, AL_INVALID_NAME);
319 ALCcontext_DecRef(Context);
322 AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
324 ALCcontext *Context;
325 ALCdevice *Device;
326 ALeffect *ALEffect;
328 Context = GetContextRef();
329 if(!Context) return;
331 Device = Context->Device;
332 if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
334 /* Call the appropriate handler */
335 ALeffect_GetParamfv(ALEffect, Context, param, pflValues);
337 else
338 alSetError(Context, AL_INVALID_NAME);
340 ALCcontext_DecRef(Context);
344 static void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
346 switch(param)
348 case AL_EAXREVERB_DECAY_HFLIMIT:
349 if(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT)
350 effect->Reverb.DecayHFLimit = val;
351 else
352 alSetError(context, AL_INVALID_VALUE);
353 break;
355 default:
356 alSetError(context, AL_INVALID_ENUM);
357 break;
360 static void eaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
362 eaxreverb_SetParami(effect, context, param, vals[0]);
364 static void eaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
366 switch(param)
368 case AL_EAXREVERB_DENSITY:
369 if(val >= AL_EAXREVERB_MIN_DENSITY &&
370 val <= AL_EAXREVERB_MAX_DENSITY)
371 effect->Reverb.Density = val;
372 else
373 alSetError(context, AL_INVALID_VALUE);
374 break;
376 case AL_EAXREVERB_DIFFUSION:
377 if(val >= AL_EAXREVERB_MIN_DIFFUSION &&
378 val <= AL_EAXREVERB_MAX_DIFFUSION)
379 effect->Reverb.Diffusion = val;
380 else
381 alSetError(context, AL_INVALID_VALUE);
382 break;
384 case AL_EAXREVERB_GAIN:
385 if(val >= AL_EAXREVERB_MIN_GAIN &&
386 val <= AL_EAXREVERB_MAX_GAIN)
387 effect->Reverb.Gain = val;
388 else
389 alSetError(context, AL_INVALID_VALUE);
390 break;
392 case AL_EAXREVERB_GAINHF:
393 if(val >= AL_EAXREVERB_MIN_GAINHF &&
394 val <= AL_EAXREVERB_MAX_GAINHF)
395 effect->Reverb.GainHF = val;
396 else
397 alSetError(context, AL_INVALID_VALUE);
398 break;
400 case AL_EAXREVERB_GAINLF:
401 if(val >= AL_EAXREVERB_MIN_GAINLF &&
402 val <= AL_EAXREVERB_MAX_GAINLF)
403 effect->Reverb.GainLF = val;
404 else
405 alSetError(context, AL_INVALID_VALUE);
406 break;
408 case AL_EAXREVERB_DECAY_TIME:
409 if(val >= AL_EAXREVERB_MIN_DECAY_TIME &&
410 val <= AL_EAXREVERB_MAX_DECAY_TIME)
411 effect->Reverb.DecayTime = val;
412 else
413 alSetError(context, AL_INVALID_VALUE);
414 break;
416 case AL_EAXREVERB_DECAY_HFRATIO:
417 if(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO &&
418 val <= AL_EAXREVERB_MAX_DECAY_HFRATIO)
419 effect->Reverb.DecayHFRatio = val;
420 else
421 alSetError(context, AL_INVALID_VALUE);
422 break;
424 case AL_EAXREVERB_DECAY_LFRATIO:
425 if(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO &&
426 val <= AL_EAXREVERB_MAX_DECAY_LFRATIO)
427 effect->Reverb.DecayLFRatio = val;
428 else
429 alSetError(context, AL_INVALID_VALUE);
430 break;
432 case AL_EAXREVERB_REFLECTIONS_GAIN:
433 if(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN &&
434 val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN)
435 effect->Reverb.ReflectionsGain = val;
436 else
437 alSetError(context, AL_INVALID_VALUE);
438 break;
440 case AL_EAXREVERB_REFLECTIONS_DELAY:
441 if(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY &&
442 val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY)
443 effect->Reverb.ReflectionsDelay = val;
444 else
445 alSetError(context, AL_INVALID_VALUE);
446 break;
448 case AL_EAXREVERB_LATE_REVERB_GAIN:
449 if(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN &&
450 val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN)
451 effect->Reverb.LateReverbGain = val;
452 else
453 alSetError(context, AL_INVALID_VALUE);
454 break;
456 case AL_EAXREVERB_LATE_REVERB_DELAY:
457 if(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY &&
458 val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY)
459 effect->Reverb.LateReverbDelay = val;
460 else
461 alSetError(context, AL_INVALID_VALUE);
462 break;
464 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
465 if(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF &&
466 val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF)
467 effect->Reverb.AirAbsorptionGainHF = val;
468 else
469 alSetError(context, AL_INVALID_VALUE);
470 break;
472 case AL_EAXREVERB_ECHO_TIME:
473 if(val >= AL_EAXREVERB_MIN_ECHO_TIME &&
474 val <= AL_EAXREVERB_MAX_ECHO_TIME)
475 effect->Reverb.EchoTime = val;
476 else
477 alSetError(context, AL_INVALID_VALUE);
478 break;
480 case AL_EAXREVERB_ECHO_DEPTH:
481 if(val >= AL_EAXREVERB_MIN_ECHO_DEPTH &&
482 val <= AL_EAXREVERB_MAX_ECHO_DEPTH)
483 effect->Reverb.EchoDepth = val;
484 else
485 alSetError(context, AL_INVALID_VALUE);
486 break;
488 case AL_EAXREVERB_MODULATION_TIME:
489 if(val >= AL_EAXREVERB_MIN_MODULATION_TIME &&
490 val <= AL_EAXREVERB_MAX_MODULATION_TIME)
491 effect->Reverb.ModulationTime = val;
492 else
493 alSetError(context, AL_INVALID_VALUE);
494 break;
496 case AL_EAXREVERB_MODULATION_DEPTH:
497 if(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH &&
498 val <= AL_EAXREVERB_MAX_MODULATION_DEPTH)
499 effect->Reverb.ModulationDepth = val;
500 else
501 alSetError(context, AL_INVALID_VALUE);
502 break;
504 case AL_EAXREVERB_HFREFERENCE:
505 if(val >= AL_EAXREVERB_MIN_HFREFERENCE &&
506 val <= AL_EAXREVERB_MAX_HFREFERENCE)
507 effect->Reverb.HFReference = val;
508 else
509 alSetError(context, AL_INVALID_VALUE);
510 break;
512 case AL_EAXREVERB_LFREFERENCE:
513 if(val >= AL_EAXREVERB_MIN_LFREFERENCE &&
514 val <= AL_EAXREVERB_MAX_LFREFERENCE)
515 effect->Reverb.LFReference = val;
516 else
517 alSetError(context, AL_INVALID_VALUE);
518 break;
520 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
521 if(val >= 0.0f && val <= 10.0f)
522 effect->Reverb.RoomRolloffFactor = val;
523 else
524 alSetError(context, AL_INVALID_VALUE);
525 break;
527 default:
528 alSetError(context, AL_INVALID_ENUM);
529 break;
532 static void eaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
534 switch(param)
536 case AL_EAXREVERB_REFLECTIONS_PAN:
537 if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))
539 LockContext(context);
540 effect->Reverb.ReflectionsPan[0] = vals[0];
541 effect->Reverb.ReflectionsPan[1] = vals[1];
542 effect->Reverb.ReflectionsPan[2] = vals[2];
543 UnlockContext(context);
545 else
546 alSetError(context, AL_INVALID_VALUE);
547 break;
548 case AL_EAXREVERB_LATE_REVERB_PAN:
549 if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))
551 LockContext(context);
552 effect->Reverb.LateReverbPan[0] = vals[0];
553 effect->Reverb.LateReverbPan[1] = vals[1];
554 effect->Reverb.LateReverbPan[2] = vals[2];
555 UnlockContext(context);
557 else
558 alSetError(context, AL_INVALID_VALUE);
559 break;
561 default:
562 eaxreverb_SetParamf(effect, context, param, vals[0]);
563 break;
567 static void eaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
569 switch(param)
571 case AL_EAXREVERB_DECAY_HFLIMIT:
572 *val = effect->Reverb.DecayHFLimit;
573 break;
575 default:
576 alSetError(context, AL_INVALID_ENUM);
577 break;
580 static void eaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
582 eaxreverb_GetParami(effect, context, param, vals);
584 static void eaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
586 switch(param)
588 case AL_EAXREVERB_DENSITY:
589 *val = effect->Reverb.Density;
590 break;
592 case AL_EAXREVERB_DIFFUSION:
593 *val = effect->Reverb.Diffusion;
594 break;
596 case AL_EAXREVERB_GAIN:
597 *val = effect->Reverb.Gain;
598 break;
600 case AL_EAXREVERB_GAINHF:
601 *val = effect->Reverb.GainHF;
602 break;
604 case AL_EAXREVERB_GAINLF:
605 *val = effect->Reverb.GainLF;
606 break;
608 case AL_EAXREVERB_DECAY_TIME:
609 *val = effect->Reverb.DecayTime;
610 break;
612 case AL_EAXREVERB_DECAY_HFRATIO:
613 *val = effect->Reverb.DecayHFRatio;
614 break;
616 case AL_EAXREVERB_DECAY_LFRATIO:
617 *val = effect->Reverb.DecayLFRatio;
618 break;
620 case AL_EAXREVERB_REFLECTIONS_GAIN:
621 *val = effect->Reverb.ReflectionsGain;
622 break;
624 case AL_EAXREVERB_REFLECTIONS_DELAY:
625 *val = effect->Reverb.ReflectionsDelay;
626 break;
628 case AL_EAXREVERB_LATE_REVERB_GAIN:
629 *val = effect->Reverb.LateReverbGain;
630 break;
632 case AL_EAXREVERB_LATE_REVERB_DELAY:
633 *val = effect->Reverb.LateReverbDelay;
634 break;
636 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
637 *val = effect->Reverb.AirAbsorptionGainHF;
638 break;
640 case AL_EAXREVERB_ECHO_TIME:
641 *val = effect->Reverb.EchoTime;
642 break;
644 case AL_EAXREVERB_ECHO_DEPTH:
645 *val = effect->Reverb.EchoDepth;
646 break;
648 case AL_EAXREVERB_MODULATION_TIME:
649 *val = effect->Reverb.ModulationTime;
650 break;
652 case AL_EAXREVERB_MODULATION_DEPTH:
653 *val = effect->Reverb.ModulationDepth;
654 break;
656 case AL_EAXREVERB_HFREFERENCE:
657 *val = effect->Reverb.HFReference;
658 break;
660 case AL_EAXREVERB_LFREFERENCE:
661 *val = effect->Reverb.LFReference;
662 break;
664 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
665 *val = effect->Reverb.RoomRolloffFactor;
666 break;
668 default:
669 alSetError(context, AL_INVALID_ENUM);
670 break;
673 static void eaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
675 switch(param)
677 case AL_EAXREVERB_REFLECTIONS_PAN:
678 LockContext(context);
679 vals[0] = effect->Reverb.ReflectionsPan[0];
680 vals[1] = effect->Reverb.ReflectionsPan[1];
681 vals[2] = effect->Reverb.ReflectionsPan[2];
682 UnlockContext(context);
683 break;
684 case AL_EAXREVERB_LATE_REVERB_PAN:
685 LockContext(context);
686 vals[0] = effect->Reverb.LateReverbPan[0];
687 vals[1] = effect->Reverb.LateReverbPan[1];
688 vals[2] = effect->Reverb.LateReverbPan[2];
689 UnlockContext(context);
690 break;
692 default:
693 eaxreverb_GetParamf(effect, context, param, vals);
694 break;
699 static void reverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
701 switch(param)
703 case AL_REVERB_DECAY_HFLIMIT:
704 if(val >= AL_REVERB_MIN_DECAY_HFLIMIT &&
705 val <= AL_REVERB_MAX_DECAY_HFLIMIT)
706 effect->Reverb.DecayHFLimit = val;
707 else
708 alSetError(context, AL_INVALID_VALUE);
709 break;
711 default:
712 alSetError(context, AL_INVALID_ENUM);
713 break;
716 static void reverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
718 reverb_SetParami(effect, context, param, vals[0]);
720 static void reverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
722 switch(param)
724 case AL_REVERB_DENSITY:
725 if(val >= AL_REVERB_MIN_DENSITY &&
726 val <= AL_REVERB_MAX_DENSITY)
727 effect->Reverb.Density = val;
728 else
729 alSetError(context, AL_INVALID_VALUE);
730 break;
732 case AL_REVERB_DIFFUSION:
733 if(val >= AL_REVERB_MIN_DIFFUSION &&
734 val <= AL_REVERB_MAX_DIFFUSION)
735 effect->Reverb.Diffusion = val;
736 else
737 alSetError(context, AL_INVALID_VALUE);
738 break;
740 case AL_REVERB_GAIN:
741 if(val >= AL_REVERB_MIN_GAIN &&
742 val <= AL_REVERB_MAX_GAIN)
743 effect->Reverb.Gain = val;
744 else
745 alSetError(context, AL_INVALID_VALUE);
746 break;
748 case AL_REVERB_GAINHF:
749 if(val >= AL_REVERB_MIN_GAINHF &&
750 val <= AL_REVERB_MAX_GAINHF)
751 effect->Reverb.GainHF = val;
752 else
753 alSetError(context, AL_INVALID_VALUE);
754 break;
756 case AL_REVERB_DECAY_TIME:
757 if(val >= AL_REVERB_MIN_DECAY_TIME &&
758 val <= AL_REVERB_MAX_DECAY_TIME)
759 effect->Reverb.DecayTime = val;
760 else
761 alSetError(context, AL_INVALID_VALUE);
762 break;
764 case AL_REVERB_DECAY_HFRATIO:
765 if(val >= AL_REVERB_MIN_DECAY_HFRATIO &&
766 val <= AL_REVERB_MAX_DECAY_HFRATIO)
767 effect->Reverb.DecayHFRatio = val;
768 else
769 alSetError(context, AL_INVALID_VALUE);
770 break;
772 case AL_REVERB_REFLECTIONS_GAIN:
773 if(val >= AL_REVERB_MIN_REFLECTIONS_GAIN &&
774 val <= AL_REVERB_MAX_REFLECTIONS_GAIN)
775 effect->Reverb.ReflectionsGain = val;
776 else
777 alSetError(context, AL_INVALID_VALUE);
778 break;
780 case AL_REVERB_REFLECTIONS_DELAY:
781 if(val >= AL_REVERB_MIN_REFLECTIONS_DELAY &&
782 val <= AL_REVERB_MAX_REFLECTIONS_DELAY)
783 effect->Reverb.ReflectionsDelay = val;
784 else
785 alSetError(context, AL_INVALID_VALUE);
786 break;
788 case AL_REVERB_LATE_REVERB_GAIN:
789 if(val >= AL_REVERB_MIN_LATE_REVERB_GAIN &&
790 val <= AL_REVERB_MAX_LATE_REVERB_GAIN)
791 effect->Reverb.LateReverbGain = val;
792 else
793 alSetError(context, AL_INVALID_VALUE);
794 break;
796 case AL_REVERB_LATE_REVERB_DELAY:
797 if(val >= AL_REVERB_MIN_LATE_REVERB_DELAY &&
798 val <= AL_REVERB_MAX_LATE_REVERB_DELAY)
799 effect->Reverb.LateReverbDelay = val;
800 else
801 alSetError(context, AL_INVALID_VALUE);
802 break;
804 case AL_REVERB_AIR_ABSORPTION_GAINHF:
805 if(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF &&
806 val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF)
807 effect->Reverb.AirAbsorptionGainHF = val;
808 else
809 alSetError(context, AL_INVALID_VALUE);
810 break;
812 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
813 if(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR &&
814 val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR)
815 effect->Reverb.RoomRolloffFactor = val;
816 else
817 alSetError(context, AL_INVALID_VALUE);
818 break;
820 default:
821 alSetError(context, AL_INVALID_ENUM);
822 break;
825 static void reverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
827 reverb_SetParamf(effect, context, param, vals[0]);
830 static void reverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
832 switch(param)
834 case AL_REVERB_DECAY_HFLIMIT:
835 *val = effect->Reverb.DecayHFLimit;
836 break;
838 default:
839 alSetError(context, AL_INVALID_ENUM);
840 break;
843 static void reverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
845 reverb_GetParami(effect, context, param, vals);
847 static void reverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
849 switch(param)
851 case AL_REVERB_DENSITY:
852 *val = effect->Reverb.Density;
853 break;
855 case AL_REVERB_DIFFUSION:
856 *val = effect->Reverb.Diffusion;
857 break;
859 case AL_REVERB_GAIN:
860 *val = effect->Reverb.Gain;
861 break;
863 case AL_REVERB_GAINHF:
864 *val = effect->Reverb.GainHF;
865 break;
867 case AL_REVERB_DECAY_TIME:
868 *val = effect->Reverb.DecayTime;
869 break;
871 case AL_REVERB_DECAY_HFRATIO:
872 *val = effect->Reverb.DecayHFRatio;
873 break;
875 case AL_REVERB_REFLECTIONS_GAIN:
876 *val = effect->Reverb.ReflectionsGain;
877 break;
879 case AL_REVERB_REFLECTIONS_DELAY:
880 *val = effect->Reverb.ReflectionsDelay;
881 break;
883 case AL_REVERB_LATE_REVERB_GAIN:
884 *val = effect->Reverb.LateReverbGain;
885 break;
887 case AL_REVERB_LATE_REVERB_DELAY:
888 *val = effect->Reverb.LateReverbDelay;
889 break;
891 case AL_REVERB_AIR_ABSORPTION_GAINHF:
892 *val = effect->Reverb.AirAbsorptionGainHF;
893 break;
895 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
896 *val = effect->Reverb.RoomRolloffFactor;
897 break;
899 default:
900 alSetError(context, AL_INVALID_ENUM);
901 break;
904 static void reverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
906 reverb_GetParamf(effect, context, param, vals);
910 static void echo_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
911 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
912 static void echo_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
914 echo_SetParami(effect, context, param, vals[0]);
916 static void echo_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
918 switch(param)
920 case AL_ECHO_DELAY:
921 if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY)
922 effect->Echo.Delay = val;
923 else
924 alSetError(context, AL_INVALID_VALUE);
925 break;
927 case AL_ECHO_LRDELAY:
928 if(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY)
929 effect->Echo.LRDelay = val;
930 else
931 alSetError(context, AL_INVALID_VALUE);
932 break;
934 case AL_ECHO_DAMPING:
935 if(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING)
936 effect->Echo.Damping = val;
937 else
938 alSetError(context, AL_INVALID_VALUE);
939 break;
941 case AL_ECHO_FEEDBACK:
942 if(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK)
943 effect->Echo.Feedback = val;
944 else
945 alSetError(context, AL_INVALID_VALUE);
946 break;
948 case AL_ECHO_SPREAD:
949 if(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD)
950 effect->Echo.Spread = val;
951 else
952 alSetError(context, AL_INVALID_VALUE);
953 break;
955 default:
956 alSetError(context, AL_INVALID_ENUM);
957 break;
960 static void echo_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
962 echo_SetParamf(effect, context, param, vals[0]);
965 static void echo_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
966 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
967 static void echo_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
969 echo_GetParami(effect, context, param, vals);
971 static void echo_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
973 switch(param)
975 case AL_ECHO_DELAY:
976 *val = effect->Echo.Delay;
977 break;
979 case AL_ECHO_LRDELAY:
980 *val = effect->Echo.LRDelay;
981 break;
983 case AL_ECHO_DAMPING:
984 *val = effect->Echo.Damping;
985 break;
987 case AL_ECHO_FEEDBACK:
988 *val = effect->Echo.Feedback;
989 break;
991 case AL_ECHO_SPREAD:
992 *val = effect->Echo.Spread;
993 break;
995 default:
996 alSetError(context, AL_INVALID_ENUM);
997 break;
1000 static void echo_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
1002 echo_GetParamf(effect, context, param, vals);
1006 static void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
1008 switch(param)
1010 case AL_RING_MODULATOR_FREQUENCY:
1011 if(val >= AL_RING_MODULATOR_MIN_FREQUENCY &&
1012 val <= AL_RING_MODULATOR_MAX_FREQUENCY)
1013 effect->Modulator.Frequency = val;
1014 else
1015 alSetError(context, AL_INVALID_VALUE);
1016 break;
1018 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1019 if(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF &&
1020 val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF)
1021 effect->Modulator.HighPassCutoff = val;
1022 else
1023 alSetError(context, AL_INVALID_VALUE);
1024 break;
1026 case AL_RING_MODULATOR_WAVEFORM:
1027 if(val >= AL_RING_MODULATOR_MIN_WAVEFORM &&
1028 val <= AL_RING_MODULATOR_MAX_WAVEFORM)
1029 effect->Modulator.Waveform = val;
1030 else
1031 alSetError(context, AL_INVALID_VALUE);
1032 break;
1034 default:
1035 alSetError(context, AL_INVALID_ENUM);
1036 break;
1039 static void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
1041 mod_SetParami(effect, context, param, vals[0]);
1043 static void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
1045 switch(param)
1047 case AL_RING_MODULATOR_FREQUENCY:
1048 if(val >= AL_RING_MODULATOR_MIN_FREQUENCY &&
1049 val <= AL_RING_MODULATOR_MAX_FREQUENCY)
1050 effect->Modulator.Frequency = val;
1051 else
1052 alSetError(context, AL_INVALID_VALUE);
1053 break;
1055 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1056 if(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF &&
1057 val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF)
1058 effect->Modulator.HighPassCutoff = val;
1059 else
1060 alSetError(context, AL_INVALID_VALUE);
1061 break;
1063 default:
1064 alSetError(context, AL_INVALID_ENUM);
1065 break;
1068 static void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
1070 mod_SetParamf(effect, context, param, vals[0]);
1073 static void mod_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
1075 switch(param)
1077 case AL_RING_MODULATOR_FREQUENCY:
1078 *val = (ALint)effect->Modulator.Frequency;
1079 break;
1080 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1081 *val = (ALint)effect->Modulator.HighPassCutoff;
1082 break;
1083 case AL_RING_MODULATOR_WAVEFORM:
1084 *val = effect->Modulator.Waveform;
1085 break;
1087 default:
1088 alSetError(context, AL_INVALID_ENUM);
1089 break;
1092 static void mod_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
1094 mod_GetParami(effect, context, param, vals);
1096 static void mod_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
1098 switch(param)
1100 case AL_RING_MODULATOR_FREQUENCY:
1101 *val = effect->Modulator.Frequency;
1102 break;
1103 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1104 *val = effect->Modulator.HighPassCutoff;
1105 break;
1107 default:
1108 alSetError(context, AL_INVALID_ENUM);
1109 break;
1112 static void mod_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
1114 mod_GetParamf(effect, context, param, vals);
1118 static void ded_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
1119 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1120 static void ded_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
1122 ded_SetParami(effect, context, param, vals[0]);
1124 static void ded_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
1126 switch(param)
1128 case AL_DEDICATED_GAIN:
1129 if(val >= 0.0f && isfinite(val))
1130 effect->Dedicated.Gain = val;
1131 else
1132 alSetError(context, AL_INVALID_VALUE);
1133 break;
1135 default:
1136 alSetError(context, AL_INVALID_ENUM);
1137 break;
1140 static void ded_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
1142 ded_SetParamf(effect, context, param, vals[0]);
1145 static void ded_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
1146 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1147 static void ded_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
1149 ded_GetParami(effect, context, param, vals);
1151 static void ded_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
1153 switch(param)
1155 case AL_DEDICATED_GAIN:
1156 *val = effect->Dedicated.Gain;
1157 break;
1159 default:
1160 alSetError(context, AL_INVALID_ENUM);
1161 break;
1164 static void ded_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
1166 ded_GetParamf(effect, context, param, vals);
1170 static void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
1171 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1172 static void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
1173 { (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); }
1174 static void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
1175 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1176 static void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
1177 { (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); }
1179 static void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
1180 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1181 static void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
1182 { (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); }
1183 static void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
1184 { (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
1185 static void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
1186 { (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); }
1189 ALvoid ReleaseALEffects(ALCdevice *device)
1191 ALsizei i;
1192 for(i = 0;i < device->EffectMap.size;i++)
1194 ALeffect *temp = device->EffectMap.array[i].value;
1195 device->EffectMap.array[i].value = NULL;
1197 // Release effect structure
1198 FreeThunkEntry(temp->effect);
1199 memset(temp, 0, sizeof(ALeffect));
1200 free(temp);
1205 static void InitEffectParams(ALeffect *effect, ALenum type)
1207 switch(type)
1209 case AL_EFFECT_EAXREVERB:
1210 effect->Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
1211 effect->Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
1212 effect->Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
1213 effect->Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
1214 effect->Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
1215 effect->Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
1216 effect->Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
1217 effect->Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
1218 effect->Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
1219 effect->Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
1220 effect->Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1221 effect->Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1222 effect->Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1223 effect->Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
1224 effect->Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
1225 effect->Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1226 effect->Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1227 effect->Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1228 effect->Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
1229 effect->Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
1230 effect->Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
1231 effect->Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
1232 effect->Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
1233 effect->Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
1234 effect->Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
1235 effect->Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
1236 effect->Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
1237 effect->SetParami = eaxreverb_SetParami;
1238 effect->SetParamiv = eaxreverb_SetParamiv;
1239 effect->SetParamf = eaxreverb_SetParamf;
1240 effect->SetParamfv = eaxreverb_SetParamfv;
1241 effect->GetParami = eaxreverb_GetParami;
1242 effect->GetParamiv = eaxreverb_GetParamiv;
1243 effect->GetParamf = eaxreverb_GetParamf;
1244 effect->GetParamfv = eaxreverb_GetParamfv;
1245 break;
1246 case AL_EFFECT_REVERB:
1247 effect->Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
1248 effect->Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
1249 effect->Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
1250 effect->Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
1251 effect->Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
1252 effect->Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
1253 effect->Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
1254 effect->Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
1255 effect->Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
1256 effect->Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
1257 effect->Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
1258 effect->Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
1259 effect->Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
1260 effect->SetParami = reverb_SetParami;
1261 effect->SetParamiv = reverb_SetParamiv;
1262 effect->SetParamf = reverb_SetParamf;
1263 effect->SetParamfv = reverb_SetParamfv;
1264 effect->GetParami = reverb_GetParami;
1265 effect->GetParamiv = reverb_GetParamiv;
1266 effect->GetParamf = reverb_GetParamf;
1267 effect->GetParamfv = reverb_GetParamfv;
1268 break;
1269 case AL_EFFECT_ECHO:
1270 effect->Echo.Delay = AL_ECHO_DEFAULT_DELAY;
1271 effect->Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY;
1272 effect->Echo.Damping = AL_ECHO_DEFAULT_DAMPING;
1273 effect->Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK;
1274 effect->Echo.Spread = AL_ECHO_DEFAULT_SPREAD;
1275 effect->SetParami = echo_SetParami;
1276 effect->SetParamiv = echo_SetParamiv;
1277 effect->SetParamf = echo_SetParamf;
1278 effect->SetParamfv = echo_SetParamfv;
1279 effect->GetParami = echo_GetParami;
1280 effect->GetParamiv = echo_GetParamiv;
1281 effect->GetParamf = echo_GetParamf;
1282 effect->GetParamfv = echo_GetParamfv;
1283 break;
1284 case AL_EFFECT_RING_MODULATOR:
1285 effect->Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY;
1286 effect->Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF;
1287 effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
1288 effect->SetParami = mod_SetParami;
1289 effect->SetParamiv = mod_SetParamiv;
1290 effect->SetParamf = mod_SetParamf;
1291 effect->SetParamfv = mod_SetParamfv;
1292 effect->GetParami = mod_GetParami;
1293 effect->GetParamiv = mod_GetParamiv;
1294 effect->GetParamf = mod_GetParamf;
1295 effect->GetParamfv = mod_GetParamfv;
1296 break;
1297 case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT:
1298 case AL_EFFECT_DEDICATED_DIALOGUE:
1299 effect->Dedicated.Gain = 1.0f;
1300 effect->SetParami = ded_SetParami;
1301 effect->SetParamiv = ded_SetParamiv;
1302 effect->SetParamf = ded_SetParamf;
1303 effect->SetParamfv = ded_SetParamfv;
1304 effect->GetParami = ded_GetParami;
1305 effect->GetParamiv = ded_GetParamiv;
1306 effect->GetParamf = ded_GetParamf;
1307 effect->GetParamfv = ded_GetParamfv;
1308 break;
1309 default:
1310 effect->SetParami = null_SetParami;
1311 effect->SetParamiv = null_SetParamiv;
1312 effect->SetParamf = null_SetParamf;
1313 effect->SetParamfv = null_SetParamfv;
1314 effect->GetParami = null_GetParami;
1315 effect->GetParamiv = null_GetParamiv;
1316 effect->GetParamf = null_GetParamf;
1317 effect->GetParamfv = null_GetParamfv;
1318 break;
1320 effect->type = type;