diff options
author | Chris Robinson <[email protected]> | 2012-01-19 20:02:57 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-01-19 20:02:57 -0800 |
commit | 37b17c8c783aba13d5c5f16e40632945126180a9 (patch) | |
tree | 1da1bd302f1fcd2785867a123b2e14b11a8aa5a9 | |
parent | 51e81f4867a02001f390222b6ce86bf212a38bd6 (diff) |
Add the ability to specify a preset for forced reverb
-rw-r--r-- | Alc/ALc.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 2 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 80 | ||||
-rw-r--r-- | include/AL/efx-presets.h | 113 |
4 files changed, 194 insertions, 3 deletions
@@ -724,7 +724,7 @@ static void alc_initconfig(void) str = getenv("__ALSOFT_FORCE_REVERB"); if(str && str[0]) - GetReverbEffect(&ForcedEffect); + GetReverbEffect(str, &ForcedEffect); } diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 264ada0d..97def48a 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -102,7 +102,7 @@ typedef struct ALeffect static __inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } -ALvoid GetReverbEffect(ALeffect *effect); +ALvoid GetReverbEffect(const char *name, ALeffect *effect); ALvoid ReleaseALEffects(ALCdevice *device); #ifdef __cplusplus diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index d7f7c3c1..99127fac 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -1308,7 +1308,85 @@ static void InitEffectParams(ALeffect *effect, ALenum type) } -ALvoid GetReverbEffect(ALeffect *effect) +#include "AL/efx-presets.h" + +#define DECL(x) { #x, EFX_REVERB_PRESET_##x } +static const struct { + const char name[32]; + EFXEAXREVERBPROPERTIES props; +} reverblist[] = { + DECL(GENERIC), + DECL(PADDEDCELL), + DECL(ROOM), + DECL(BATHROOM), + DECL(LIVINGROOM), + DECL(STONEROOM), + DECL(AUDITORIUM), + DECL(CONCERTHALL), + DECL(CAVE), + DECL(ARENA), + DECL(HANGAR), + DECL(CARPETTEDHALLWAY), + DECL(HALLWAY), + DECL(STONECORRIDOR), + DECL(ALLEY), + DECL(FOREST), + DECL(CITY), + DECL(MOUNTAINS), + DECL(QUARRY), + DECL(PLAIN), + DECL(PARKINGLOT), + DECL(SEWERPIPE), + DECL(UNDERWATER), + DECL(DRUGGED), + DECL(DIZZY), + DECL(PSYCHOTIC), + { "", EFX_REVERB_PRESET_GENERIC } +}; + +ALvoid GetReverbEffect(const char *name, ALeffect *effect) { + int i; + InitEffectParams(effect, AL_EFFECT_EAXREVERB); + for(i = 0;reverblist[i].name[0];i++) + { + const EFXEAXREVERBPROPERTIES *props; + + if(strcasecmp(name, reverblist[i].name) != 0) + continue; + + TRACE("Loading reverb '%s'\n", reverblist[i].name); + props = &reverblist[i].props; + effect->Reverb.Density = props->flDensity; + effect->Reverb.Diffusion = props->flDiffusion; + effect->Reverb.Gain = props->flGain; + effect->Reverb.GainHF = props->flGainHF; + effect->Reverb.GainLF = props->flGainLF; + effect->Reverb.DecayTime = props->flDecayTime; + effect->Reverb.DecayHFRatio = props->flDecayHFRatio; + effect->Reverb.DecayLFRatio = props->flDecayLFRatio; + effect->Reverb.ReflectionsGain = props->flReflectionsGain; + effect->Reverb.ReflectionsDelay = props->flReflectionsDelay; + effect->Reverb.ReflectionsPan[0] = props->flReflectionsPan[0]; + effect->Reverb.ReflectionsPan[1] = props->flReflectionsPan[1]; + effect->Reverb.ReflectionsPan[2] = props->flReflectionsPan[2]; + effect->Reverb.LateReverbGain = props->flLateReverbGain; + effect->Reverb.LateReverbDelay = props->flLateReverbDelay; + effect->Reverb.LateReverbPan[0] = props->flLateReverbPan[0]; + effect->Reverb.LateReverbPan[1] = props->flLateReverbPan[1]; + effect->Reverb.LateReverbPan[2] = props->flLateReverbPan[2]; + effect->Reverb.EchoTime = props->flEchoTime; + effect->Reverb.EchoDepth = props->flEchoDepth; + effect->Reverb.ModulationTime = props->flModulationTime; + effect->Reverb.ModulationDepth = props->flModulationDepth; + effect->Reverb.AirAbsorptionGainHF = props->flAirAbsorptionGainHF; + effect->Reverb.HFReference = props->flHFReference; + effect->Reverb.LFReference = props->flLFReference; + effect->Reverb.RoomRolloffFactor = props->flRoomRolloffFactor; + effect->Reverb.DecayHFLimit = props->iDecayHFLimit; + break; + } + if(!reverblist[i].name[0]) + WARN("Reverb preset '%s' not found\n", name); } diff --git a/include/AL/efx-presets.h b/include/AL/efx-presets.h new file mode 100644 index 00000000..f2f747cf --- /dev/null +++ b/include/AL/efx-presets.h @@ -0,0 +1,113 @@ +/* Reverb presets for EFX */ + +#ifndef EFX_PRESETS_H +#define EFX_PRESETS_H + +#ifndef EFXEAXREVERBPROPERTIES_DEFINED +#define EFXEAXREVERBPROPERTIES_DEFINED +typedef struct { + float flDensity; + float flDiffusion; + float flGain; + float flGainHF; + float flGainLF; + float flDecayTime; + float flDecayHFRatio; + float flDecayLFRatio; + float flReflectionsGain; + float flReflectionsDelay; + float flReflectionsPan[3]; + float flLateReverbGain; + float flLateReverbDelay; + float flLateReverbPan[3]; + float flEchoTime; + float flEchoDepth; + float flModulationTime; + float flModulationDepth; + float flAirAbsorptionGainHF; + float flHFReference; + float flLFReference; + float flRoomRolloffFactor; + int iDecayHFLimit; +} EFXEAXREVERBPROPERTIES, *LPEFXEAXREVERBPROPERTIES; +#endif + +#define EFX_REVERB_PRESET_GENERIC \ + { 1.0000, 1.0000, 0.3162, 0.8913, 1.0000, 1.4900, 0.8300, 1.0000, 0.0500, 0.0070, { 0.0000, 0.0000, 0.0000 }, 1.2589, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_PADDEDCELL \ + { 0.1715, 1.0000, 0.3162, 0.0010, 1.0000, 0.1700, 0.1000, 1.0000, 0.2500, 0.0010, { 0.0000, 0.0000, 0.0000 }, 1.2691, 0.0020, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_ROOM \ + { 0.4287, 1.0000, 0.3162, 0.5929, 1.0000, 0.4000, 0.8300, 1.0000, 0.1503, 0.0020, { 0.0000, 0.0000, 0.0000 }, 1.0629, 0.0030, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_BATHROOM \ + { 0.1715, 1.0000, 0.3162, 0.2512, 1.0000, 1.4900, 0.5400, 1.0000, 0.6531, 0.0070, { 0.0000, 0.0000, 0.0000 }, 3.2734, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_LIVINGROOM \ + { 0.9766, 1.0000, 0.3162, 0.0010, 1.0000, 0.5000, 0.1000, 1.0000, 0.2051, 0.0030, { 0.0000, 0.0000, 0.0000 }, 0.2805, 0.0040, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_STONEROOM \ + { 1.0000, 1.0000, 0.3162, 0.7079, 1.0000, 2.3100, 0.6400, 1.0000, 0.4411, 0.0120, { 0.0000, 0.0000, 0.0000 }, 1.1003, 0.0170, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_AUDITORIUM \ + { 1.0000, 1.0000, 0.3162, 0.5781, 1.0000, 4.3200, 0.5900, 1.0000, 0.4032, 0.0200, { 0.0000, 0.0000, 0.0000 }, 0.7170, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_CONCERTHALL \ + { 1.0000, 1.0000, 0.3162, 0.5623, 1.0000, 3.9200, 0.7000, 1.0000, 0.2427, 0.0200, { 0.0000, 0.0000, 0.0000 }, 0.9977, 0.0290, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_CAVE \ + { 1.0000, 1.0000, 0.3162, 1.0000, 1.0000, 2.9100, 1.3000, 1.0000, 0.5000, 0.0150, { 0.0000, 0.0000, 0.0000 }, 0.7063, 0.0220, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#define EFX_REVERB_PRESET_ARENA \ + { 1.0000, 1.0000, 0.3162, 0.4477, 1.0000, 7.2400, 0.3300, 1.0000, 0.2612, 0.0200, { 0.0000, 0.0000, 0.0000 }, 1.0186, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_HANGAR \ + { 1.0000, 1.0000, 0.3162, 0.3162, 1.0000, 10.0500, 0.2300, 1.0000, 0.5000, 0.0200, { 0.0000, 0.0000, 0.0000 }, 1.2560, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_CARPETTEDHALLWAY \ + { 0.4287, 1.0000, 0.3162, 0.0100, 1.0000, 0.3000, 0.1000, 1.0000, 0.1215, 0.0020, { 0.0000, 0.0000, 0.0000 }, 0.1531, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_HALLWAY \ + { 0.3645, 1.0000, 0.3162, 0.7079, 1.0000, 1.4900, 0.5900, 1.0000, 0.2458, 0.0070, { 0.0000, 0.0000, 0.0000 }, 1.6615, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_STONECORRIDOR \ + { 1.0000, 1.0000, 0.3162, 0.7612, 1.0000, 2.7000, 0.7900, 1.0000, 0.2472, 0.0130, { 0.0000, 0.0000, 0.0000 }, 1.5758, 0.0200, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_ALLEY \ + { 1.0000, 0.3000, 0.3162, 0.7328, 1.0000, 1.4900, 0.8600, 1.0000, 0.2500, 0.0070, { 0.0000, 0.0000, 0.0000 }, 0.9954, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.1250, 0.9500, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_FOREST \ + { 1.0000, 0.3000, 0.3162, 0.0224, 1.0000, 1.4900, 0.5400, 1.0000, 0.0525, 0.1620, { 0.0000, 0.0000, 0.0000 }, 0.7682, 0.0880, { 0.0000, 0.0000, 0.0000 }, 0.1250, 1.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_CITY \ + { 1.0000, 0.5000, 0.3162, 0.3981, 1.0000, 1.4900, 0.6700, 1.0000, 0.0730, 0.0070, { 0.0000, 0.0000, 0.0000 }, 0.1427, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_MOUNTAINS \ + { 1.0000, 0.2700, 0.3162, 0.0562, 1.0000, 1.4900, 0.2100, 1.0000, 0.0407, 0.3000, { 0.0000, 0.0000, 0.0000 }, 0.1919, 0.1000, { 0.0000, 0.0000, 0.0000 }, 0.2500, 1.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#define EFX_REVERB_PRESET_QUARRY \ + { 1.0000, 1.0000, 0.3162, 0.3162, 1.0000, 1.4900, 0.8300, 1.0000, 0.0000, 0.0610, { 0.0000, 0.0000, 0.0000 }, 1.7783, 0.0250, { 0.0000, 0.0000, 0.0000 }, 0.1250, 0.7000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_PLAIN \ + { 1.0000, 0.2100, 0.3162, 0.1000, 1.0000, 1.4900, 0.5000, 1.0000, 0.0585, 0.1790, { 0.0000, 0.0000, 0.0000 }, 0.1089, 0.1000, { 0.0000, 0.0000, 0.0000 }, 0.2500, 1.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_PARKINGLOT \ + { 1.0000, 1.0000, 0.3162, 1.0000, 1.0000, 1.6500, 1.5000, 1.0000, 0.2082, 0.0080, { 0.0000, 0.0000, 0.0000 }, 0.2652, 0.0120, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#define EFX_REVERB_PRESET_SEWERPIPE \ + { 0.3071, 0.8000, 0.3162, 0.3162, 1.0000, 2.8100, 0.1400, 1.0000, 1.6387, 0.0140, { 0.0000, 0.0000, 0.0000 }, 3.2471, 0.0210, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 0.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_UNDERWATER \ + { 0.3645, 1.0000, 0.3162, 0.0100, 1.0000, 1.4900, 0.1000, 1.0000, 0.5963, 0.0070, { 0.0000, 0.0000, 0.0000 }, 7.0795, 0.0110, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 1.1800, 0.3480, 0.9943, 5000.0000, 250.0000, 0.0000, 0x1 } + +#define EFX_REVERB_PRESET_DRUGGED \ + { 0.4287, 0.5000, 0.3162, 1.0000, 1.0000, 8.3900, 1.3900, 1.0000, 0.8760, 0.0020, { 0.0000, 0.0000, 0.0000 }, 3.1081, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 0.2500, 1.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#define EFX_REVERB_PRESET_DIZZY \ + { 0.3645, 0.6000, 0.3162, 0.6310, 1.0000, 17.2300, 0.5600, 1.0000, 0.1392, 0.0200, { 0.0000, 0.0000, 0.0000 }, 0.4937, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 1.0000, 0.8100, 0.3100, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#define EFX_REVERB_PRESET_PSYCHOTIC \ + { 0.0625, 0.5000, 0.3162, 0.8404, 1.0000, 7.5600, 0.9100, 1.0000, 0.4864, 0.0200, { 0.0000, 0.0000, 0.0000 }, 2.4378, 0.0300, { 0.0000, 0.0000, 0.0000 }, 0.2500, 0.0000, 4.0000, 1.0000, 0.9943, 5000.0000, 250.0000, 0.0000, 0x0 } + +#endif /* EFX_PRESETS_H */ |