Finalize AL_SOFT_buffer_samples
[openal-soft.git] / OpenAL32 / alEffect.c
blob112120099d2e145a550115676ab9b725235f8b22
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);
40 AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
42 ALCcontext *Context;
43 ALsizei i;
45 Context = GetContextRef();
46 if(!Context) return;
48 if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
49 alSetError(Context, AL_INVALID_VALUE);
50 else
52 ALCdevice *device = Context->Device;
53 ALenum err;
55 for(i = 0;i < n;i++)
57 ALeffect *effect = calloc(1, sizeof(ALeffect));
58 if(!effect)
60 alSetError(Context, AL_OUT_OF_MEMORY);
61 alDeleteEffects(i, effects);
62 break;
64 InitEffectParams(effect, AL_EFFECT_NULL);
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));
73 free(effect);
75 alSetError(Context, err);
76 alDeleteEffects(i, effects);
77 break;
80 effects[i] = effect->effect;
84 ALCcontext_DecRef(Context);
87 AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
89 ALCcontext *Context;
90 ALCdevice *device;
91 ALeffect *ALEffect;
92 ALsizei i;
94 Context = GetContextRef();
95 if(!Context) return;
97 device = Context->Device;
98 if(n < 0)
99 alSetError(Context, AL_INVALID_VALUE);
100 else
102 // Check that all effects are valid
103 for(i = 0;i < n;i++)
105 if(!effects[i])
106 continue;
108 if(LookupEffect(device, effects[i]) == NULL)
110 alSetError(Context, AL_INVALID_NAME);
111 n = 0;
112 break;
116 for(i = 0;i < n;i++)
118 // Recheck that the effect is valid, because there could be duplicated names
119 if((ALEffect=RemoveEffect(device, effects[i])) == NULL)
120 continue;
121 FreeThunkEntry(ALEffect->effect);
123 memset(ALEffect, 0, sizeof(ALeffect));
124 free(ALEffect);
128 ALCcontext_DecRef(Context);
131 AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
133 ALCcontext *Context;
134 ALboolean result;
136 Context = GetContextRef();
137 if(!Context) return AL_FALSE;
139 result = ((!effect || LookupEffect(Context->Device, effect)) ?
140 AL_TRUE : AL_FALSE);
142 ALCcontext_DecRef(Context);
144 return result;
147 AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
149 ALCcontext *Context;
150 ALCdevice *Device;
151 ALeffect *ALEffect;
153 Context = GetContextRef();
154 if(!Context) return;
156 Device = Context->Device;
157 if((ALEffect=LookupEffect(Device, effect)) != NULL)
159 if(param == AL_EFFECT_TYPE)
161 ALboolean isOk = (iValue == AL_EFFECT_NULL);
162 ALint i;
163 for(i = 0;!isOk && EffectList[i].val;i++)
165 if(iValue == EffectList[i].val &&
166 !DisabledEffects[EffectList[i].type])
167 isOk = AL_TRUE;
170 if(isOk)
171 InitEffectParams(ALEffect, iValue);
172 else
173 alSetError(Context, AL_INVALID_VALUE);
175 else
177 /* Call the appropriate handler */
178 ALeffect_SetParami(ALEffect, Context, param, iValue);
181 else
182 alSetError(Context, AL_INVALID_NAME);
184 ALCcontext_DecRef(Context);
187 AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues)
189 ALCcontext *Context;
190 ALCdevice *Device;
191 ALeffect *ALEffect;
193 Context = GetContextRef();
194 if(!Context) return;
196 Device = Context->Device;
197 if((ALEffect=LookupEffect(Device, effect)) != NULL)
199 /* Call the appropriate handler */
200 ALeffect_SetParamiv(ALEffect, Context, param, piValues);
202 else
203 alSetError(Context, AL_INVALID_NAME);
205 ALCcontext_DecRef(Context);
208 AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue)
210 ALCcontext *Context;
211 ALCdevice *Device;
212 ALeffect *ALEffect;
214 Context = GetContextRef();
215 if(!Context) return;
217 Device = Context->Device;
218 if((ALEffect=LookupEffect(Device, effect)) != NULL)
220 /* Call the appropriate handler */
221 ALeffect_SetParamf(ALEffect, Context, param, flValue);
223 else
224 alSetError(Context, AL_INVALID_NAME);
226 ALCcontext_DecRef(Context);
229 AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues)
231 ALCcontext *Context;
232 ALCdevice *Device;
233 ALeffect *ALEffect;
235 Context = GetContextRef();
236 if(!Context) return;
238 Device = Context->Device;
239 if((ALEffect=LookupEffect(Device, effect)) != NULL)
241 /* Call the appropriate handler */
242 ALeffect_SetParamfv(ALEffect, Context, param, pflValues);
244 else
245 alSetError(Context, AL_INVALID_NAME);
247 ALCcontext_DecRef(Context);
250 AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue)
252 ALCcontext *Context;
253 ALCdevice *Device;
254 ALeffect *ALEffect;
256 Context = GetContextRef();
257 if(!Context) return;
259 Device = Context->Device;
260 if((ALEffect=LookupEffect(Device, effect)) != NULL)
262 if(param == AL_EFFECT_TYPE)
264 *piValue = ALEffect->type;
266 else
268 /* Call the appropriate handler */
269 ALeffect_GetParamiv(ALEffect, Context, param, piValue);
272 else
273 alSetError(Context, AL_INVALID_NAME);
275 ALCcontext_DecRef(Context);
278 AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues)
280 ALCcontext *Context;
281 ALCdevice *Device;
282 ALeffect *ALEffect;
284 Context = GetContextRef();
285 if(!Context) return;
287 Device = Context->Device;
288 if((ALEffect=LookupEffect(Device, effect)) != NULL)
290 /* Call the appropriate handler */
291 ALeffect_GetParamiv(ALEffect, Context, param, piValues);
293 else
294 alSetError(Context, AL_INVALID_NAME);
296 ALCcontext_DecRef(Context);
299 AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue)
301 ALCcontext *Context;
302 ALCdevice *Device;
303 ALeffect *ALEffect;
305 Context = GetContextRef();
306 if(!Context) return;
308 Device = Context->Device;
309 if((ALEffect=LookupEffect(Device, effect)) != NULL)
311 /* Call the appropriate handler */
312 ALeffect_GetParamf(ALEffect, Context, param, pflValue);
314 else
315 alSetError(Context, AL_INVALID_NAME);
317 ALCcontext_DecRef(Context);
320 AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
322 ALCcontext *Context;
323 ALCdevice *Device;
324 ALeffect *ALEffect;
326 Context = GetContextRef();
327 if(!Context) return;
329 Device = Context->Device;
330 if((ALEffect=LookupEffect(Device, effect)) != NULL)
332 /* Call the appropriate handler */
333 ALeffect_GetParamfv(ALEffect, Context, param, pflValues);
335 else
336 alSetError(Context, AL_INVALID_NAME);
338 ALCcontext_DecRef(Context);
342 static void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
344 switch(param)
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;
349 else
350 alSetError(context, AL_INVALID_VALUE);
351 break;
353 default:
354 alSetError(context, AL_INVALID_ENUM);
355 break;
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)
364 switch(param)
366 case AL_EAXREVERB_DENSITY:
367 if(val >= AL_EAXREVERB_MIN_DENSITY &&
368 val <= AL_EAXREVERB_MAX_DENSITY)
369 effect->Reverb.Density = val;
370 else
371 alSetError(context, AL_INVALID_VALUE);
372 break;
374 case AL_EAXREVERB_DIFFUSION:
375 if(val >= AL_EAXREVERB_MIN_DIFFUSION &&
376 val <= AL_EAXREVERB_MAX_DIFFUSION)
377 effect->Reverb.Diffusion = val;
378 else
379 alSetError(context, AL_INVALID_VALUE);
380 break;
382 case AL_EAXREVERB_GAIN:
383 if(val >= AL_EAXREVERB_MIN_GAIN &&
384 val <= AL_EAXREVERB_MAX_GAIN)
385 effect->Reverb.Gain = val;
386 else
387 alSetError(context, AL_INVALID_VALUE);
388 break;
390 case AL_EAXREVERB_GAINHF:
391 if(val >= AL_EAXREVERB_MIN_GAINHF &&
392 val <= AL_EAXREVERB_MAX_GAINHF)
393 effect->Reverb.GainHF = val;
394 else
395 alSetError(context, AL_INVALID_VALUE);
396 break;
398 case AL_EAXREVERB_GAINLF:
399 if(val >= AL_EAXREVERB_MIN_GAINLF &&
400 val <= AL_EAXREVERB_MAX_GAINLF)
401 effect->Reverb.GainLF = val;
402 else
403 alSetError(context, AL_INVALID_VALUE);
404 break;
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;
410 else
411 alSetError(context, AL_INVALID_VALUE);
412 break;
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;
418 else
419 alSetError(context, AL_INVALID_VALUE);
420 break;
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;
426 else
427 alSetError(context, AL_INVALID_VALUE);
428 break;
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;
434 else
435 alSetError(context, AL_INVALID_VALUE);
436 break;
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;
442 else
443 alSetError(context, AL_INVALID_VALUE);
444 break;
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;
450 else
451 alSetError(context, AL_INVALID_VALUE);
452 break;
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;
458 else
459 alSetError(context, AL_INVALID_VALUE);
460 break;
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;
466 else
467 alSetError(context, AL_INVALID_VALUE);
468 break;
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;
474 else
475 alSetError(context, AL_INVALID_VALUE);
476 break;
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;
482 else
483 alSetError(context, AL_INVALID_VALUE);
484 break;
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;
490 else
491 alSetError(context, AL_INVALID_VALUE);
492 break;
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;
498 else
499 alSetError(context, AL_INVALID_VALUE);
500 break;
502 case AL_EAXREVERB_HFREFERENCE:
503 if(val >= AL_EAXREVERB_MIN_HFREFERENCE &&
504 val <= AL_EAXREVERB_MAX_HFREFERENCE)
505 effect->Reverb.HFReference = val;
506 else
507 alSetError(context, AL_INVALID_VALUE);
508 break;
510 case AL_EAXREVERB_LFREFERENCE:
511 if(val >= AL_EAXREVERB_MIN_LFREFERENCE &&
512 val <= AL_EAXREVERB_MAX_LFREFERENCE)
513 effect->Reverb.LFReference = val;
514 else
515 alSetError(context, AL_INVALID_VALUE);
516 break;
518 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
519 if(val >= 0.0f && val <= 10.0f)
520 effect->Reverb.RoomRolloffFactor = val;
521 else
522 alSetError(context, AL_INVALID_VALUE);
523 break;
525 default:
526 alSetError(context, AL_INVALID_ENUM);
527 break;
530 static void eaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
532 switch(param)
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);
543 else
544 alSetError(context, AL_INVALID_VALUE);
545 break;
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);
555 else
556 alSetError(context, AL_INVALID_VALUE);
557 break;
559 default:
560 eaxreverb_SetParamf(effect, context, param, vals[0]);
561 break;
565 static void eaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
567 switch(param)
569 case AL_EAXREVERB_DECAY_HFLIMIT:
570 *val = effect->Reverb.DecayHFLimit;
571 break;
573 default:
574 alSetError(context, AL_INVALID_ENUM);
575 break;
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)
584 switch(param)
586 case AL_EAXREVERB_DENSITY:
587 *val = effect->Reverb.Density;
588 break;
590 case AL_EAXREVERB_DIFFUSION:
591 *val = effect->Reverb.Diffusion;
592 break;
594 case AL_EAXREVERB_GAIN:
595 *val = effect->Reverb.Gain;
596 break;
598 case AL_EAXREVERB_GAINHF:
599 *val = effect->Reverb.GainHF;
600 break;
602 case AL_EAXREVERB_GAINLF:
603 *val = effect->Reverb.GainLF;
604 break;
606 case AL_EAXREVERB_DECAY_TIME:
607 *val = effect->Reverb.DecayTime;
608 break;
610 case AL_EAXREVERB_DECAY_HFRATIO:
611 *val = effect->Reverb.DecayHFRatio;
612 break;
614 case AL_EAXREVERB_DECAY_LFRATIO:
615 *val = effect->Reverb.DecayLFRatio;
616 break;
618 case AL_EAXREVERB_REFLECTIONS_GAIN:
619 *val = effect->Reverb.ReflectionsGain;
620 break;
622 case AL_EAXREVERB_REFLECTIONS_DELAY:
623 *val = effect->Reverb.ReflectionsDelay;
624 break;
626 case AL_EAXREVERB_LATE_REVERB_GAIN:
627 *val = effect->Reverb.LateReverbGain;
628 break;
630 case AL_EAXREVERB_LATE_REVERB_DELAY:
631 *val = effect->Reverb.LateReverbDelay;
632 break;
634 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
635 *val = effect->Reverb.AirAbsorptionGainHF;
636 break;
638 case AL_EAXREVERB_ECHO_TIME:
639 *val = effect->Reverb.EchoTime;
640 break;
642 case AL_EAXREVERB_ECHO_DEPTH:
643 *val = effect->Reverb.EchoDepth;
644 break;
646 case AL_EAXREVERB_MODULATION_TIME:
647 *val = effect->Reverb.ModulationTime;
648 break;
650 case AL_EAXREVERB_MODULATION_DEPTH:
651 *val = effect->Reverb.ModulationDepth;
652 break;
654 case AL_EAXREVERB_HFREFERENCE:
655 *val = effect->Reverb.HFReference;
656 break;
658 case AL_EAXREVERB_LFREFERENCE:
659 *val = effect->Reverb.LFReference;
660 break;
662 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
663 *val = effect->Reverb.RoomRolloffFactor;
664 break;
666 default:
667 alSetError(context, AL_INVALID_ENUM);
668 break;
671 static void eaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
673 switch(param)
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);
681 break;
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);
688 break;
690 default:
691 eaxreverb_GetParamf(effect, context, param, vals);
692 break;
697 static void reverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
699 switch(param)
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;
705 else
706 alSetError(context, AL_INVALID_VALUE);
707 break;
709 default:
710 alSetError(context, AL_INVALID_ENUM);
711 break;
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)
720 switch(param)
722 case AL_REVERB_DENSITY:
723 if(val >= AL_REVERB_MIN_DENSITY &&
724 val <= AL_REVERB_MAX_DENSITY)
725 effect->Reverb.Density = val;
726 else
727 alSetError(context, AL_INVALID_VALUE);
728 break;
730 case AL_REVERB_DIFFUSION:
731 if(val >= AL_REVERB_MIN_DIFFUSION &&
732 val <= AL_REVERB_MAX_DIFFUSION)
733 effect->Reverb.Diffusion = val;
734 else
735 alSetError(context, AL_INVALID_VALUE);
736 break;
738 case AL_REVERB_GAIN:
739 if(val >= AL_REVERB_MIN_GAIN &&
740 val <= AL_REVERB_MAX_GAIN)
741 effect->Reverb.Gain = val;
742 else
743 alSetError(context, AL_INVALID_VALUE);
744 break;
746 case AL_REVERB_GAINHF:
747 if(val >= AL_REVERB_MIN_GAINHF &&
748 val <= AL_REVERB_MAX_GAINHF)
749 effect->Reverb.GainHF = val;
750 else
751 alSetError(context, AL_INVALID_VALUE);
752 break;
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;
758 else
759 alSetError(context, AL_INVALID_VALUE);
760 break;
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;
766 else
767 alSetError(context, AL_INVALID_VALUE);
768 break;
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;
774 else
775 alSetError(context, AL_INVALID_VALUE);
776 break;
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;
782 else
783 alSetError(context, AL_INVALID_VALUE);
784 break;
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;
790 else
791 alSetError(context, AL_INVALID_VALUE);
792 break;
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;
798 else
799 alSetError(context, AL_INVALID_VALUE);
800 break;
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;
806 else
807 alSetError(context, AL_INVALID_VALUE);
808 break;
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;
814 else
815 alSetError(context, AL_INVALID_VALUE);
816 break;
818 default:
819 alSetError(context, AL_INVALID_ENUM);
820 break;
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)
830 switch(param)
832 case AL_REVERB_DECAY_HFLIMIT:
833 *val = effect->Reverb.DecayHFLimit;
834 break;
836 default:
837 alSetError(context, AL_INVALID_ENUM);
838 break;
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)
847 switch(param)
849 case AL_REVERB_DENSITY:
850 *val = effect->Reverb.Density;
851 break;
853 case AL_REVERB_DIFFUSION:
854 *val = effect->Reverb.Diffusion;
855 break;
857 case AL_REVERB_GAIN:
858 *val = effect->Reverb.Gain;
859 break;
861 case AL_REVERB_GAINHF:
862 *val = effect->Reverb.GainHF;
863 break;
865 case AL_REVERB_DECAY_TIME:
866 *val = effect->Reverb.DecayTime;
867 break;
869 case AL_REVERB_DECAY_HFRATIO:
870 *val = effect->Reverb.DecayHFRatio;
871 break;
873 case AL_REVERB_REFLECTIONS_GAIN:
874 *val = effect->Reverb.ReflectionsGain;
875 break;
877 case AL_REVERB_REFLECTIONS_DELAY:
878 *val = effect->Reverb.ReflectionsDelay;
879 break;
881 case AL_REVERB_LATE_REVERB_GAIN:
882 *val = effect->Reverb.LateReverbGain;
883 break;
885 case AL_REVERB_LATE_REVERB_DELAY:
886 *val = effect->Reverb.LateReverbDelay;
887 break;
889 case AL_REVERB_AIR_ABSORPTION_GAINHF:
890 *val = effect->Reverb.AirAbsorptionGainHF;
891 break;
893 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
894 *val = effect->Reverb.RoomRolloffFactor;
895 break;
897 default:
898 alSetError(context, AL_INVALID_ENUM);
899 break;
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)
916 switch(param)
918 case AL_ECHO_DELAY:
919 if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY)
920 effect->Echo.Delay = val;
921 else
922 alSetError(context, AL_INVALID_VALUE);
923 break;
925 case AL_ECHO_LRDELAY:
926 if(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY)
927 effect->Echo.LRDelay = val;
928 else
929 alSetError(context, AL_INVALID_VALUE);
930 break;
932 case AL_ECHO_DAMPING:
933 if(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING)
934 effect->Echo.Damping = val;
935 else
936 alSetError(context, AL_INVALID_VALUE);
937 break;
939 case AL_ECHO_FEEDBACK:
940 if(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK)
941 effect->Echo.Feedback = val;
942 else
943 alSetError(context, AL_INVALID_VALUE);
944 break;
946 case AL_ECHO_SPREAD:
947 if(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD)
948 effect->Echo.Spread = val;
949 else
950 alSetError(context, AL_INVALID_VALUE);
951 break;
953 default:
954 alSetError(context, AL_INVALID_ENUM);
955 break;
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)
971 switch(param)
973 case AL_ECHO_DELAY:
974 *val = effect->Echo.Delay;
975 break;
977 case AL_ECHO_LRDELAY:
978 *val = effect->Echo.LRDelay;
979 break;
981 case AL_ECHO_DAMPING:
982 *val = effect->Echo.Damping;
983 break;
985 case AL_ECHO_FEEDBACK:
986 *val = effect->Echo.Feedback;
987 break;
989 case AL_ECHO_SPREAD:
990 *val = effect->Echo.Spread;
991 break;
993 default:
994 alSetError(context, AL_INVALID_ENUM);
995 break;
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)
1006 switch(param)
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;
1012 else
1013 alSetError(context, AL_INVALID_VALUE);
1014 break;
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;
1020 else
1021 alSetError(context, AL_INVALID_VALUE);
1022 break;
1024 default:
1025 alSetError(context, AL_INVALID_ENUM);
1026 break;
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)
1035 switch(param)
1037 case AL_RING_MODULATOR_FREQUENCY:
1038 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1039 mod_SetParamf(effect, context, param, (ALfloat)val);
1040 break;
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;
1046 else
1047 alSetError(context, AL_INVALID_VALUE);
1048 break;
1050 default:
1051 alSetError(context, AL_INVALID_ENUM);
1052 break;
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)
1062 switch(param)
1064 case AL_RING_MODULATOR_FREQUENCY:
1065 *val = (ALint)effect->Modulator.Frequency;
1066 break;
1067 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1068 *val = (ALint)effect->Modulator.HighPassCutoff;
1069 break;
1070 case AL_RING_MODULATOR_WAVEFORM:
1071 *val = effect->Modulator.Waveform;
1072 break;
1074 default:
1075 alSetError(context, AL_INVALID_ENUM);
1076 break;
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)
1085 switch(param)
1087 case AL_RING_MODULATOR_FREQUENCY:
1088 *val = effect->Modulator.Frequency;
1089 break;
1090 case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
1091 *val = effect->Modulator.HighPassCutoff;
1092 break;
1094 default:
1095 alSetError(context, AL_INVALID_ENUM);
1096 break;
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)
1113 switch(param)
1115 case AL_DEDICATED_GAIN:
1116 if(val >= 0.0f && isfinite(val))
1117 effect->Dedicated.Gain = val;
1118 else
1119 alSetError(context, AL_INVALID_VALUE);
1120 break;
1122 default:
1123 alSetError(context, AL_INVALID_ENUM);
1124 break;
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)
1140 switch(param)
1142 case AL_DEDICATED_GAIN:
1143 *val = effect->Dedicated.Gain;
1144 break;
1146 default:
1147 alSetError(context, AL_INVALID_ENUM);
1148 break;
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 ALvoid ReleaseALEffects(ALCdevice *device)
1178 ALsizei i;
1179 for(i = 0;i < device->EffectMap.size;i++)
1181 ALeffect *temp = device->EffectMap.array[i].value;
1182 device->EffectMap.array[i].value = NULL;
1184 // Release effect structure
1185 FreeThunkEntry(temp->effect);
1186 memset(temp, 0, sizeof(ALeffect));
1187 free(temp);
1192 static void InitEffectParams(ALeffect *effect, ALenum type)
1194 switch(type)
1196 case AL_EFFECT_EAXREVERB:
1197 effect->Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
1198 effect->Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
1199 effect->Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
1200 effect->Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
1201 effect->Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
1202 effect->Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
1203 effect->Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
1204 effect->Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
1205 effect->Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
1206 effect->Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
1207 effect->Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1208 effect->Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1209 effect->Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
1210 effect->Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
1211 effect->Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
1212 effect->Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1213 effect->Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1214 effect->Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
1215 effect->Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
1216 effect->Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
1217 effect->Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
1218 effect->Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
1219 effect->Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
1220 effect->Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
1221 effect->Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
1222 effect->Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
1223 effect->Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
1224 effect->SetParami = eaxreverb_SetParami;
1225 effect->SetParamiv = eaxreverb_SetParamiv;
1226 effect->SetParamf = eaxreverb_SetParamf;
1227 effect->SetParamfv = eaxreverb_SetParamfv;
1228 effect->GetParami = eaxreverb_GetParami;
1229 effect->GetParamiv = eaxreverb_GetParamiv;
1230 effect->GetParamf = eaxreverb_GetParamf;
1231 effect->GetParamfv = eaxreverb_GetParamfv;
1232 break;
1233 case AL_EFFECT_REVERB:
1234 effect->Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
1235 effect->Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
1236 effect->Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
1237 effect->Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
1238 effect->Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
1239 effect->Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
1240 effect->Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
1241 effect->Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
1242 effect->Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
1243 effect->Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
1244 effect->Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
1245 effect->Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
1246 effect->Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
1247 effect->SetParami = reverb_SetParami;
1248 effect->SetParamiv = reverb_SetParamiv;
1249 effect->SetParamf = reverb_SetParamf;
1250 effect->SetParamfv = reverb_SetParamfv;
1251 effect->GetParami = reverb_GetParami;
1252 effect->GetParamiv = reverb_GetParamiv;
1253 effect->GetParamf = reverb_GetParamf;
1254 effect->GetParamfv = reverb_GetParamfv;
1255 break;
1256 case AL_EFFECT_ECHO:
1257 effect->Echo.Delay = AL_ECHO_DEFAULT_DELAY;
1258 effect->Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY;
1259 effect->Echo.Damping = AL_ECHO_DEFAULT_DAMPING;
1260 effect->Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK;
1261 effect->Echo.Spread = AL_ECHO_DEFAULT_SPREAD;
1262 effect->SetParami = echo_SetParami;
1263 effect->SetParamiv = echo_SetParamiv;
1264 effect->SetParamf = echo_SetParamf;
1265 effect->SetParamfv = echo_SetParamfv;
1266 effect->GetParami = echo_GetParami;
1267 effect->GetParamiv = echo_GetParamiv;
1268 effect->GetParamf = echo_GetParamf;
1269 effect->GetParamfv = echo_GetParamfv;
1270 break;
1271 case AL_EFFECT_RING_MODULATOR:
1272 effect->Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY;
1273 effect->Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF;
1274 effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
1275 effect->SetParami = mod_SetParami;
1276 effect->SetParamiv = mod_SetParamiv;
1277 effect->SetParamf = mod_SetParamf;
1278 effect->SetParamfv = mod_SetParamfv;
1279 effect->GetParami = mod_GetParami;
1280 effect->GetParamiv = mod_GetParamiv;
1281 effect->GetParamf = mod_GetParamf;
1282 effect->GetParamfv = mod_GetParamfv;
1283 break;
1284 case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT:
1285 case AL_EFFECT_DEDICATED_DIALOGUE:
1286 effect->Dedicated.Gain = 1.0f;
1287 effect->SetParami = ded_SetParami;
1288 effect->SetParamiv = ded_SetParamiv;
1289 effect->SetParamf = ded_SetParamf;
1290 effect->SetParamfv = ded_SetParamfv;
1291 effect->GetParami = ded_GetParami;
1292 effect->GetParamiv = ded_GetParamiv;
1293 effect->GetParamf = ded_GetParamf;
1294 effect->GetParamfv = ded_GetParamfv;
1295 break;
1296 default:
1297 effect->SetParami = null_SetParami;
1298 effect->SetParamiv = null_SetParamiv;
1299 effect->SetParamf = null_SetParamf;
1300 effect->SetParamfv = null_SetParamfv;
1301 effect->GetParami = null_GetParami;
1302 effect->GetParamiv = null_GetParamiv;
1303 effect->GetParamf = null_GetParamf;
1304 effect->GetParamfv = null_GetParamfv;
1305 break;
1307 effect->type = type;