Simplify setting a fontsound link
[openal-soft.git] / OpenAL32 / alEffect.c
blobc9e5928f90754e3a2c81c400ab57a869d11cb277
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>
25 #include <float.h>
27 #include "AL/al.h"
28 #include "AL/alc.h"
29 #include "alMain.h"
30 #include "alEffect.h"
31 #include "alThunk.h"
32 #include "alError.h"
35 ALboolean DisabledEffects[MAX_EFFECTS];
37 extern inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id);
38 extern inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id);
39 extern inline ALboolean IsReverbEffect(ALenum type);
41 static void InitEffectParams(ALeffect *effect, ALenum type);
44 AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
46 ALCdevice *device;
47 ALCcontext *context;
48 ALsizei cur;
50 context = GetContextRef();
51 if(!context) return;
53 if(!(n >= 0))
54 SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
56 device = context->Device;
57 for(cur = 0;cur < n;cur++)
59 ALeffect *effect = calloc(1, sizeof(ALeffect));
60 ALenum err = AL_OUT_OF_MEMORY;
61 if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR)
63 free(effect);
64 alDeleteEffects(cur, effects);
65 SET_ERROR_AND_GOTO(context, err, done);
68 err = NewThunkEntry(&effect->id);
69 if(err == AL_NO_ERROR)
70 err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect);
71 if(err != AL_NO_ERROR)
73 FreeThunkEntry(effect->id);
74 memset(effect, 0, sizeof(ALeffect));
75 free(effect);
77 alDeleteEffects(cur, effects);
78 SET_ERROR_AND_GOTO(context, err, done);
81 effects[cur] = effect->id;
84 done:
85 ALCcontext_DecRef(context);
88 AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
90 ALCdevice *device;
91 ALCcontext *context;
92 ALeffect *effect;
93 ALsizei i;
95 context = GetContextRef();
96 if(!context) return;
98 if(!(n >= 0))
99 SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
101 device = context->Device;
102 for(i = 0;i < n;i++)
104 if(effects[i] && LookupEffect(device, effects[i]) == NULL)
105 SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
107 for(i = 0;i < n;i++)
109 if((effect=RemoveEffect(device, effects[i])) == NULL)
110 continue;
111 FreeThunkEntry(effect->id);
113 memset(effect, 0, sizeof(*effect));
114 free(effect);
117 done:
118 ALCcontext_DecRef(context);
121 AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
123 ALCcontext *Context;
124 ALboolean result;
126 Context = GetContextRef();
127 if(!Context) return AL_FALSE;
129 result = ((!effect || LookupEffect(Context->Device, effect)) ?
130 AL_TRUE : AL_FALSE);
132 ALCcontext_DecRef(Context);
134 return result;
137 AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value)
139 ALCcontext *Context;
140 ALCdevice *Device;
141 ALeffect *ALEffect;
143 Context = GetContextRef();
144 if(!Context) return;
146 Device = Context->Device;
147 if((ALEffect=LookupEffect(Device, effect)) == NULL)
148 alSetError(Context, AL_INVALID_NAME);
149 else
151 if(param == AL_EFFECT_TYPE)
153 ALboolean isOk = (value == AL_EFFECT_NULL);
154 ALint i;
155 for(i = 0;!isOk && EffectList[i].val;i++)
157 if(value == EffectList[i].val &&
158 !DisabledEffects[EffectList[i].type])
159 isOk = AL_TRUE;
162 if(isOk)
163 InitEffectParams(ALEffect, value);
164 else
165 alSetError(Context, AL_INVALID_VALUE);
167 else
169 /* Call the appropriate handler */
170 V(ALEffect,setParami)(Context, param, value);
174 ALCcontext_DecRef(Context);
177 AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *values)
179 ALCcontext *Context;
180 ALCdevice *Device;
181 ALeffect *ALEffect;
183 switch(param)
185 case AL_EFFECT_TYPE:
186 alEffecti(effect, param, values[0]);
187 return;
190 Context = GetContextRef();
191 if(!Context) return;
193 Device = Context->Device;
194 if((ALEffect=LookupEffect(Device, effect)) == NULL)
195 alSetError(Context, AL_INVALID_NAME);
196 else
198 /* Call the appropriate handler */
199 V(ALEffect,setParamiv)(Context, param, values);
202 ALCcontext_DecRef(Context);
205 AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value)
207 ALCcontext *Context;
208 ALCdevice *Device;
209 ALeffect *ALEffect;
211 Context = GetContextRef();
212 if(!Context) return;
214 Device = Context->Device;
215 if((ALEffect=LookupEffect(Device, effect)) == NULL)
216 alSetError(Context, AL_INVALID_NAME);
217 else
219 /* Call the appropriate handler */
220 V(ALEffect,setParamf)(Context, param, value);
223 ALCcontext_DecRef(Context);
226 AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *values)
228 ALCcontext *Context;
229 ALCdevice *Device;
230 ALeffect *ALEffect;
232 Context = GetContextRef();
233 if(!Context) return;
235 Device = Context->Device;
236 if((ALEffect=LookupEffect(Device, effect)) == NULL)
237 alSetError(Context, AL_INVALID_NAME);
238 else
240 /* Call the appropriate handler */
241 V(ALEffect,setParamfv)(Context, param, values);
244 ALCcontext_DecRef(Context);
247 AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value)
249 ALCcontext *Context;
250 ALCdevice *Device;
251 ALeffect *ALEffect;
253 Context = GetContextRef();
254 if(!Context) return;
256 Device = Context->Device;
257 if((ALEffect=LookupEffect(Device, effect)) == NULL)
258 alSetError(Context, AL_INVALID_NAME);
259 else
261 if(param == AL_EFFECT_TYPE)
262 *value = ALEffect->type;
263 else
265 /* Call the appropriate handler */
266 V(ALEffect,getParami)(Context, param, value);
270 ALCcontext_DecRef(Context);
273 AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *values)
275 ALCcontext *Context;
276 ALCdevice *Device;
277 ALeffect *ALEffect;
279 switch(param)
281 case AL_EFFECT_TYPE:
282 alGetEffecti(effect, param, values);
283 return;
286 Context = GetContextRef();
287 if(!Context) return;
289 Device = Context->Device;
290 if((ALEffect=LookupEffect(Device, effect)) == NULL)
291 alSetError(Context, AL_INVALID_NAME);
292 else
294 /* Call the appropriate handler */
295 V(ALEffect,getParamiv)(Context, param, values);
298 ALCcontext_DecRef(Context);
301 AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *value)
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, effect)) == NULL)
312 alSetError(Context, AL_INVALID_NAME);
313 else
315 /* Call the appropriate handler */
316 V(ALEffect,getParamf)(Context, param, value);
319 ALCcontext_DecRef(Context);
322 AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *values)
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, effect)) == NULL)
333 alSetError(Context, AL_INVALID_NAME);
334 else
336 /* Call the appropriate handler */
337 V(ALEffect,getParamfv)(Context, param, values);
340 ALCcontext_DecRef(Context);
344 ALenum InitEffect(ALeffect *effect)
346 InitEffectParams(effect, AL_EFFECT_NULL);
347 return AL_NO_ERROR;
350 ALvoid ReleaseALEffects(ALCdevice *device)
352 ALsizei i;
353 for(i = 0;i < device->EffectMap.size;i++)
355 ALeffect *temp = device->EffectMap.array[i].value;
356 device->EffectMap.array[i].value = NULL;
358 // Release effect structure
359 FreeThunkEntry(temp->id);
360 memset(temp, 0, sizeof(ALeffect));
361 free(temp);
366 static void InitEffectParams(ALeffect *effect, ALenum type)
368 switch(type)
370 case AL_EFFECT_EAXREVERB:
371 effect->Props.Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
372 effect->Props.Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
373 effect->Props.Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
374 effect->Props.Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
375 effect->Props.Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
376 effect->Props.Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
377 effect->Props.Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
378 effect->Props.Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
379 effect->Props.Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
380 effect->Props.Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
381 effect->Props.Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
382 effect->Props.Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
383 effect->Props.Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
384 effect->Props.Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
385 effect->Props.Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
386 effect->Props.Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
387 effect->Props.Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
388 effect->Props.Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
389 effect->Props.Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
390 effect->Props.Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
391 effect->Props.Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
392 effect->Props.Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
393 effect->Props.Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
394 effect->Props.Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
395 effect->Props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
396 effect->Props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
397 effect->Props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
398 SET_VTABLE1(ALeaxreverb, effect);
399 break;
400 case AL_EFFECT_REVERB:
401 effect->Props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
402 effect->Props.Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
403 effect->Props.Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
404 effect->Props.Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
405 effect->Props.Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
406 effect->Props.Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
407 effect->Props.Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
408 effect->Props.Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
409 effect->Props.Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
410 effect->Props.Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
411 effect->Props.Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
412 effect->Props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
413 effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
414 SET_VTABLE1(ALreverb, effect);
415 break;
416 case AL_EFFECT_AUTOWAH:
417 effect->Props.Autowah.AttackTime = AL_AUTOWAH_DEFAULT_ATTACK_TIME;
418 effect->Props.Autowah.PeakGain = AL_AUTOWAH_DEFAULT_PEAK_GAIN;
419 effect->Props.Autowah.ReleaseTime = AL_AUTOWAH_DEFAULT_RELEASE_TIME;
420 effect->Props.Autowah.Resonance = AL_AUTOWAH_DEFAULT_RESONANCE;
421 SET_VTABLE1(ALautowah, effect);
422 break;
423 case AL_EFFECT_CHORUS:
424 effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM;
425 effect->Props.Chorus.Phase = AL_CHORUS_DEFAULT_PHASE;
426 effect->Props.Chorus.Rate = AL_CHORUS_DEFAULT_RATE;
427 effect->Props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH;
428 effect->Props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK;
429 effect->Props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY;
430 SET_VTABLE1(ALchorus, effect);
431 break;
432 case AL_EFFECT_COMPRESSOR:
433 effect->Props.Compressor.OnOff = AL_COMPRESSOR_DEFAULT_ONOFF;
434 SET_VTABLE1(ALcompressor, effect);
435 break;
436 case AL_EFFECT_DISTORTION:
437 effect->Props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE;
438 effect->Props.Distortion.Gain = AL_DISTORTION_DEFAULT_GAIN;
439 effect->Props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF;
440 effect->Props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER;
441 effect->Props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH;
442 SET_VTABLE1(ALdistortion, effect);
443 break;
444 case AL_EFFECT_ECHO:
445 effect->Props.Echo.Delay = AL_ECHO_DEFAULT_DELAY;
446 effect->Props.Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY;
447 effect->Props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING;
448 effect->Props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK;
449 effect->Props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD;
450 SET_VTABLE1(ALecho, effect);
451 break;
452 case AL_EFFECT_EQUALIZER:
453 effect->Props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF;
454 effect->Props.Equalizer.LowGain = AL_EQUALIZER_DEFAULT_LOW_GAIN;
455 effect->Props.Equalizer.Mid1Center = AL_EQUALIZER_DEFAULT_MID1_CENTER;
456 effect->Props.Equalizer.Mid1Gain = AL_EQUALIZER_DEFAULT_MID1_GAIN;
457 effect->Props.Equalizer.Mid1Width = AL_EQUALIZER_DEFAULT_MID1_WIDTH;
458 effect->Props.Equalizer.Mid2Center = AL_EQUALIZER_DEFAULT_MID2_CENTER;
459 effect->Props.Equalizer.Mid2Gain = AL_EQUALIZER_DEFAULT_MID2_GAIN;
460 effect->Props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH;
461 effect->Props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF;
462 effect->Props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN;
463 SET_VTABLE1(ALequalizer, effect);
464 break;
465 case AL_EFFECT_FLANGER:
466 effect->Props.Flanger.Waveform = AL_FLANGER_DEFAULT_WAVEFORM;
467 effect->Props.Flanger.Phase = AL_FLANGER_DEFAULT_PHASE;
468 effect->Props.Flanger.Rate = AL_FLANGER_DEFAULT_RATE;
469 effect->Props.Flanger.Depth = AL_FLANGER_DEFAULT_DEPTH;
470 effect->Props.Flanger.Feedback = AL_FLANGER_DEFAULT_FEEDBACK;
471 effect->Props.Flanger.Delay = AL_FLANGER_DEFAULT_DELAY;
472 SET_VTABLE1(ALflanger, effect);
473 break;
474 case AL_EFFECT_RING_MODULATOR:
475 effect->Props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY;
476 effect->Props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF;
477 effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
478 SET_VTABLE1(ALmodulator, effect);
479 break;
480 case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT:
481 case AL_EFFECT_DEDICATED_DIALOGUE:
482 effect->Props.Dedicated.Gain = 1.0f;
483 SET_VTABLE1(ALdedicated, effect);
484 break;
485 default:
486 SET_VTABLE1(ALnull, effect);
487 break;
489 effect->type = type;
493 #include "AL/efx-presets.h"
495 #define DECL(x) { #x, EFX_REVERB_PRESET_##x }
496 static const struct {
497 const char name[32];
498 EFXEAXREVERBPROPERTIES props;
499 } reverblist[] = {
500 DECL(GENERIC),
501 DECL(PADDEDCELL),
502 DECL(ROOM),
503 DECL(BATHROOM),
504 DECL(LIVINGROOM),
505 DECL(STONEROOM),
506 DECL(AUDITORIUM),
507 DECL(CONCERTHALL),
508 DECL(CAVE),
509 DECL(ARENA),
510 DECL(HANGAR),
511 DECL(CARPETEDHALLWAY),
512 DECL(HALLWAY),
513 DECL(STONECORRIDOR),
514 DECL(ALLEY),
515 DECL(FOREST),
516 DECL(CITY),
517 DECL(MOUNTAINS),
518 DECL(QUARRY),
519 DECL(PLAIN),
520 DECL(PARKINGLOT),
521 DECL(SEWERPIPE),
522 DECL(UNDERWATER),
523 DECL(DRUGGED),
524 DECL(DIZZY),
525 DECL(PSYCHOTIC),
527 DECL(CASTLE_SMALLROOM),
528 DECL(CASTLE_SHORTPASSAGE),
529 DECL(CASTLE_MEDIUMROOM),
530 DECL(CASTLE_LARGEROOM),
531 DECL(CASTLE_LONGPASSAGE),
532 DECL(CASTLE_HALL),
533 DECL(CASTLE_CUPBOARD),
534 DECL(CASTLE_COURTYARD),
535 DECL(CASTLE_ALCOVE),
537 DECL(FACTORY_SMALLROOM),
538 DECL(FACTORY_SHORTPASSAGE),
539 DECL(FACTORY_MEDIUMROOM),
540 DECL(FACTORY_LARGEROOM),
541 DECL(FACTORY_LONGPASSAGE),
542 DECL(FACTORY_HALL),
543 DECL(FACTORY_CUPBOARD),
544 DECL(FACTORY_COURTYARD),
545 DECL(FACTORY_ALCOVE),
547 DECL(ICEPALACE_SMALLROOM),
548 DECL(ICEPALACE_SHORTPASSAGE),
549 DECL(ICEPALACE_MEDIUMROOM),
550 DECL(ICEPALACE_LARGEROOM),
551 DECL(ICEPALACE_LONGPASSAGE),
552 DECL(ICEPALACE_HALL),
553 DECL(ICEPALACE_CUPBOARD),
554 DECL(ICEPALACE_COURTYARD),
555 DECL(ICEPALACE_ALCOVE),
557 DECL(SPACESTATION_SMALLROOM),
558 DECL(SPACESTATION_SHORTPASSAGE),
559 DECL(SPACESTATION_MEDIUMROOM),
560 DECL(SPACESTATION_LARGEROOM),
561 DECL(SPACESTATION_LONGPASSAGE),
562 DECL(SPACESTATION_HALL),
563 DECL(SPACESTATION_CUPBOARD),
564 DECL(SPACESTATION_ALCOVE),
566 DECL(WOODEN_SMALLROOM),
567 DECL(WOODEN_SHORTPASSAGE),
568 DECL(WOODEN_MEDIUMROOM),
569 DECL(WOODEN_LARGEROOM),
570 DECL(WOODEN_LONGPASSAGE),
571 DECL(WOODEN_HALL),
572 DECL(WOODEN_CUPBOARD),
573 DECL(WOODEN_COURTYARD),
574 DECL(WOODEN_ALCOVE),
576 DECL(SPORT_EMPTYSTADIUM),
577 DECL(SPORT_SQUASHCOURT),
578 DECL(SPORT_SMALLSWIMMINGPOOL),
579 DECL(SPORT_LARGESWIMMINGPOOL),
580 DECL(SPORT_GYMNASIUM),
581 DECL(SPORT_FULLSTADIUM),
582 DECL(SPORT_STADIUMTANNOY),
584 DECL(PREFAB_WORKSHOP),
585 DECL(PREFAB_SCHOOLROOM),
586 DECL(PREFAB_PRACTISEROOM),
587 DECL(PREFAB_OUTHOUSE),
588 DECL(PREFAB_CARAVAN),
590 DECL(DOME_TOMB),
591 DECL(PIPE_SMALL),
592 DECL(DOME_SAINTPAULS),
593 DECL(PIPE_LONGTHIN),
594 DECL(PIPE_LARGE),
595 DECL(PIPE_RESONANT),
597 DECL(OUTDOORS_BACKYARD),
598 DECL(OUTDOORS_ROLLINGPLAINS),
599 DECL(OUTDOORS_DEEPCANYON),
600 DECL(OUTDOORS_CREEK),
601 DECL(OUTDOORS_VALLEY),
603 DECL(MOOD_HEAVEN),
604 DECL(MOOD_HELL),
605 DECL(MOOD_MEMORY),
607 DECL(DRIVING_COMMENTATOR),
608 DECL(DRIVING_PITGARAGE),
609 DECL(DRIVING_INCAR_RACER),
610 DECL(DRIVING_INCAR_SPORTS),
611 DECL(DRIVING_INCAR_LUXURY),
612 DECL(DRIVING_FULLGRANDSTAND),
613 DECL(DRIVING_EMPTYGRANDSTAND),
614 DECL(DRIVING_TUNNEL),
616 DECL(CITY_STREETS),
617 DECL(CITY_SUBWAY),
618 DECL(CITY_MUSEUM),
619 DECL(CITY_LIBRARY),
620 DECL(CITY_UNDERPASS),
621 DECL(CITY_ABANDONED),
623 DECL(DUSTYROOM),
624 DECL(CHAPEL),
625 DECL(SMALLWATERROOM),
627 #undef DECL
629 ALvoid LoadReverbPreset(const char *name, ALeffect *effect)
631 size_t i;
633 if(strcasecmp(name, "NONE") == 0)
635 InitEffectParams(effect, AL_EFFECT_NULL);
636 TRACE("Loading reverb '%s'\n", "NONE");
637 return;
640 if(!DisabledEffects[EAXREVERB])
641 InitEffectParams(effect, AL_EFFECT_EAXREVERB);
642 else if(!DisabledEffects[REVERB])
643 InitEffectParams(effect, AL_EFFECT_REVERB);
644 else
645 InitEffectParams(effect, AL_EFFECT_NULL);
646 for(i = 0;i < COUNTOF(reverblist);i++)
648 const EFXEAXREVERBPROPERTIES *props;
650 if(strcasecmp(name, reverblist[i].name) != 0)
651 continue;
653 TRACE("Loading reverb '%s'\n", reverblist[i].name);
654 props = &reverblist[i].props;
655 effect->Props.Reverb.Density = props->flDensity;
656 effect->Props.Reverb.Diffusion = props->flDiffusion;
657 effect->Props.Reverb.Gain = props->flGain;
658 effect->Props.Reverb.GainHF = props->flGainHF;
659 effect->Props.Reverb.GainLF = props->flGainLF;
660 effect->Props.Reverb.DecayTime = props->flDecayTime;
661 effect->Props.Reverb.DecayHFRatio = props->flDecayHFRatio;
662 effect->Props.Reverb.DecayLFRatio = props->flDecayLFRatio;
663 effect->Props.Reverb.ReflectionsGain = props->flReflectionsGain;
664 effect->Props.Reverb.ReflectionsDelay = props->flReflectionsDelay;
665 effect->Props.Reverb.ReflectionsPan[0] = props->flReflectionsPan[0];
666 effect->Props.Reverb.ReflectionsPan[1] = props->flReflectionsPan[1];
667 effect->Props.Reverb.ReflectionsPan[2] = props->flReflectionsPan[2];
668 effect->Props.Reverb.LateReverbGain = props->flLateReverbGain;
669 effect->Props.Reverb.LateReverbDelay = props->flLateReverbDelay;
670 effect->Props.Reverb.LateReverbPan[0] = props->flLateReverbPan[0];
671 effect->Props.Reverb.LateReverbPan[1] = props->flLateReverbPan[1];
672 effect->Props.Reverb.LateReverbPan[2] = props->flLateReverbPan[2];
673 effect->Props.Reverb.EchoTime = props->flEchoTime;
674 effect->Props.Reverb.EchoDepth = props->flEchoDepth;
675 effect->Props.Reverb.ModulationTime = props->flModulationTime;
676 effect->Props.Reverb.ModulationDepth = props->flModulationDepth;
677 effect->Props.Reverb.AirAbsorptionGainHF = props->flAirAbsorptionGainHF;
678 effect->Props.Reverb.HFReference = props->flHFReference;
679 effect->Props.Reverb.LFReference = props->flLFReference;
680 effect->Props.Reverb.RoomRolloffFactor = props->flRoomRolloffFactor;
681 effect->Props.Reverb.DecayHFLimit = props->iDecayHFLimit;
682 return;
685 WARN("Reverb preset '%s' not found\n", name);