summaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alEffect.h150
-rw-r--r--OpenAL32/Include/alReverb.h2
-rw-r--r--OpenAL32/alAuxEffectSlot.c27
-rw-r--r--OpenAL32/alEffect.c422
4 files changed, 580 insertions, 21 deletions
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h
index 6dd1b766..592eb541 100644
--- a/OpenAL32/Include/alEffect.h
+++ b/OpenAL32/Include/alEffect.h
@@ -1,3 +1,5 @@
+// NOTE: The effect structure is getting too large, it may be a good idea to
+// start using a union or another form of unified storage.
#ifndef _AL_EFFECT_H_
#define _AL_EFFECT_H_
@@ -22,6 +24,7 @@ extern "C" {
#define AL_EFFECT_AUTOWAH 0x000A
#define AL_EFFECT_COMPRESSOR 0x000B
#define AL_EFFECT_EQUALIZER 0x000C
+#define AL_EFFECT_EAXREVERB 0x8000
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
@@ -37,6 +40,46 @@ extern "C" {
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
+#define AL_REVERB_MIN_DENSITY (0.0f)
+#define AL_REVERB_MAX_DENSITY (1.0f)
+#define AL_REVERB_DEFAULT_DENSITY (1.0f)
+#define AL_REVERB_MIN_DIFFUSION (0.0f)
+#define AL_REVERB_MAX_DIFFUSION (1.0f)
+#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
+#define AL_REVERB_MIN_GAIN (0.0f)
+#define AL_REVERB_MAX_GAIN (1.0f)
+#define AL_REVERB_DEFAULT_GAIN (0.32f)
+#define AL_REVERB_MIN_GAINHF (0.0f)
+#define AL_REVERB_MAX_GAINHF (1.0f)
+#define AL_REVERB_DEFAULT_GAINHF (0.89f)
+#define AL_REVERB_MIN_DECAY_TIME (0.1f)
+#define AL_REVERB_MAX_DECAY_TIME (20.0f)
+#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
+#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
+#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
+#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
+#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
+#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
+#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
+#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
+#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
+#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
+#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
+#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
+#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
+#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
+#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
+#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
+#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
+#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
+#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
+#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
+#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
+#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
+#define AL_REVERB_MIN_DECAY_HFLIMIT (AL_FALSE)
+#define AL_REVERB_MAX_DECAY_HFLIMIT (AL_TRUE)
+#define AL_REVERB_DEFAULT_DECAY_HFLIMIT (AL_TRUE)
+
#define AL_ECHO_DELAY 0x0001
#define AL_ECHO_LRDELAY 0x0002
#define AL_ECHO_DAMPING 0x0003
@@ -59,25 +102,114 @@ extern "C" {
#define AL_ECHO_MAX_SPREAD (1.0f)
#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
+#define AL_EAXREVERB_DENSITY 0x0001
+#define AL_EAXREVERB_DIFFUSION 0x0002
+#define AL_EAXREVERB_GAIN 0x0003
+#define AL_EAXREVERB_GAINHF 0x0004
+#define AL_EAXREVERB_GAINLF 0x0005
+#define AL_EAXREVERB_DECAY_TIME 0x0006
+#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
+#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
+#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
+#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
+#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
+#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
+#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
+#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
+#define AL_EAXREVERB_ECHO_TIME 0x000F
+#define AL_EAXREVERB_ECHO_DEPTH 0x0010
+#define AL_EAXREVERB_MODULATION_TIME 0x0011
+#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
+#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
+#define AL_EAXREVERB_HFREFERENCE 0x0014
+#define AL_EAXREVERB_LFREFERENCE 0x0015
+#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
+#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
+
+#define AL_EAXREVERB_MIN_DENSITY (0.0f)
+#define AL_EAXREVERB_MAX_DENSITY (1.0f)
+#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
+#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
+#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
+#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
+#define AL_EAXREVERB_MIN_GAIN (0.0f)
+#define AL_EAXREVERB_MAX_GAIN (1.0f)
+#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
+#define AL_EAXREVERB_MIN_GAINHF (0.0f)
+#define AL_EAXREVERB_MAX_GAINHF (1.0f)
+#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
+#define AL_EAXREVERB_MIN_GAINLF (0.0f)
+#define AL_EAXREVERB_MAX_GAINLF (1.0f)
+#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
+#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
+#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
+#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
+#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
+#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
+#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
+#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
+#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
+#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
+#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
+#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
+#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
+#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
+#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
+#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
+#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
+#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
+#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
+#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
+#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
+#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
+#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
+#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
+#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
+#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
+#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
+#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
+#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
+#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
+#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
+#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
+#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
+#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
+#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
+#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
+#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
+#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
+#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
+#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
+#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
+#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
+#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
+#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
+#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
+#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
+#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
+#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
+#define AL_EAXREVERB_MIN_DECAY_HFLIMIT (AL_FALSE)
+#define AL_EAXREVERB_MAX_DECAY_HFLIMIT (AL_TRUE)
+#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT (AL_TRUE)
enum {
- REVERB = 0,
+ EAXREVERB = 0,
+ REVERB,
ECHO,
MAX_EFFECTS
};
extern ALboolean DisabledEffects[MAX_EFFECTS];
-
typedef struct ALeffect_struct
{
// Effect type (AL_EFFECT_NULL, ...)
ALenum type;
struct {
+ // Shared Reverb Properties
ALfloat Density;
ALfloat Diffusion;
-
ALfloat Gain;
ALfloat GainHF;
ALfloat DecayTime;
@@ -89,6 +221,18 @@ typedef struct ALeffect_struct
ALfloat AirAbsorptionGainHF;
ALfloat RoomRolloffFactor;
ALboolean DecayHFLimit;
+
+ // Additional EAX Reverb Properties
+ ALfloat GainLF;
+ ALfloat DecayLFRatio;
+ ALfloat ReflectionsPan[3];
+ ALfloat LateReverbPan[3];
+ ALfloat EchoTime;
+ ALfloat EchoDepth;
+ ALfloat ModulationTime;
+ ALfloat ModulationDepth;
+ ALfloat HFReference;
+ ALfloat LFReference;
} Reverb;
struct {
diff --git a/OpenAL32/Include/alReverb.h b/OpenAL32/Include/alReverb.h
index 46c7194c..95b5adb0 100644
--- a/OpenAL32/Include/alReverb.h
+++ b/OpenAL32/Include/alReverb.h
@@ -14,9 +14,11 @@ extern "C" {
typedef struct ALverbState ALverbState;
ALverbState *VerbCreate(ALCcontext *Context);
+ALverbState *EAXVerbCreate(ALCcontext *Context);
ALvoid VerbDestroy(ALverbState *State);
ALvoid VerbUpdate(ALCcontext *Context, struct ALeffectslot *Slot, ALeffect *Effect);
ALvoid VerbProcess(ALverbState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]);
+ALvoid EAXVerbProcess(ALverbState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]);
#ifdef __cplusplus
}
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 810b380e..c9b8ac62 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -470,38 +470,37 @@ ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, A
static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect)
{
- if(!effect)
+ if((!effect) || (effect->type != ALEffectSlot->effect.type))
{
- memset(&ALEffectSlot->effect, 0, sizeof(ALEffectSlot->effect));
VerbDestroy(ALEffectSlot->ReverbState);
ALEffectSlot->ReverbState = NULL;
EchoDestroy(ALEffectSlot->EchoState);
ALEffectSlot->EchoState = NULL;
+ }
+ if(!effect)
+ {
+ memset(&ALEffectSlot->effect, 0, sizeof(ALEffectSlot->effect));
return;
}
- if(effect->type == AL_EFFECT_REVERB)
+ memcpy(&ALEffectSlot->effect, effect, sizeof(*effect));
+ if(effect->type == AL_EFFECT_EAXREVERB)
+ {
+ if(!ALEffectSlot->ReverbState)
+ ALEffectSlot->ReverbState = EAXVerbCreate(Context);
+ VerbUpdate(Context, ALEffectSlot, effect);
+ }
+ else if(effect->type == AL_EFFECT_REVERB)
{
- if(ALEffectSlot->EchoState)
- {
- EchoDestroy(ALEffectSlot->EchoState);
- ALEffectSlot->EchoState = NULL;
- }
if(!ALEffectSlot->ReverbState)
ALEffectSlot->ReverbState = VerbCreate(Context);
VerbUpdate(Context, ALEffectSlot, effect);
}
else if(effect->type == AL_EFFECT_ECHO)
{
- if(ALEffectSlot->ReverbState)
- {
- VerbDestroy(ALEffectSlot->ReverbState);
- ALEffectSlot->ReverbState = NULL;
- }
if(!ALEffectSlot->EchoState)
ALEffectSlot->EchoState = EchoCreate(Context);
EchoUpdate(Context, ALEffectSlot, effect);
}
- memcpy(&ALEffectSlot->effect, effect, sizeof(*effect));
}
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 4455a230..4d0e7f34 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -170,6 +170,7 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
if(param == AL_EFFECT_TYPE)
{
ALboolean isOk = (iValue == AL_EFFECT_NULL ||
+ (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) ||
(iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) ||
(iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]));
@@ -178,6 +179,22 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
else
alSetError(AL_INVALID_VALUE);
}
+ else if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DECAY_HFLIMIT:
+ if(iValue == AL_TRUE || iValue == AL_FALSE)
+ ALEffect->Reverb.DecayHFLimit = iValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
@@ -227,6 +244,19 @@ ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues)
{
alEffecti(effect, param, piValues[0]);
}
+ else if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DECAY_HFLIMIT:
+ alEffecti(effect, param, piValues[0]);
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
@@ -269,7 +299,175 @@ ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue)
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
- if(ALEffect->type == AL_EFFECT_REVERB)
+ if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DENSITY:
+ if(flValue >= AL_EAXREVERB_MIN_DENSITY &&
+ flValue <= AL_EAXREVERB_MAX_DENSITY)
+ ALEffect->Reverb.Density = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_DIFFUSION:
+ if(flValue >= AL_EAXREVERB_MIN_DIFFUSION &&
+ flValue <= AL_EAXREVERB_MAX_DIFFUSION)
+ ALEffect->Reverb.Diffusion = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_GAIN:
+ if(flValue >= AL_EAXREVERB_MIN_GAIN &&
+ flValue <= AL_EAXREVERB_MAX_GAIN)
+ ALEffect->Reverb.Gain = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_GAINHF:
+ if(flValue >= AL_EAXREVERB_MIN_GAINHF &&
+ flValue <= AL_EAXREVERB_MAX_GAIN)
+ ALEffect->Reverb.GainHF = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_GAINLF:
+ if(flValue >= AL_EAXREVERB_MIN_GAINLF &&
+ flValue <= AL_EAXREVERB_MAX_GAINLF)
+ ALEffect->Reverb.GainLF = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_DECAY_TIME:
+ if(flValue >= AL_EAXREVERB_MIN_DECAY_TIME &&
+ flValue <= AL_EAXREVERB_MAX_DECAY_TIME)
+ ALEffect->Reverb.DecayTime = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_DECAY_HFRATIO:
+ if(flValue >= AL_EAXREVERB_MIN_DECAY_HFRATIO &&
+ flValue <= AL_EAXREVERB_MAX_DECAY_HFRATIO)
+ ALEffect->Reverb.DecayHFRatio = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_DECAY_LFRATIO:
+ if(flValue >= AL_EAXREVERB_MIN_DECAY_LFRATIO &&
+ flValue <= AL_EAXREVERB_MAX_DECAY_LFRATIO)
+ ALEffect->Reverb.DecayLFRatio = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_GAIN:
+ if(flValue >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN &&
+ flValue <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN)
+ ALEffect->Reverb.ReflectionsGain = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_DELAY:
+ if(flValue >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY &&
+ flValue <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY)
+ ALEffect->Reverb.ReflectionsDelay = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_LATE_REVERB_GAIN:
+ if(flValue >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN &&
+ flValue <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN)
+ ALEffect->Reverb.LateReverbGain = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_LATE_REVERB_DELAY:
+ if(flValue >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY &&
+ flValue <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY)
+ ALEffect->Reverb.LateReverbDelay = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
+ if(flValue >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF &&
+ flValue <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF)
+ ALEffect->Reverb.AirAbsorptionGainHF = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_ECHO_TIME:
+ if(flValue >= AL_EAXREVERB_MIN_ECHO_TIME &&
+ flValue <= AL_EAXREVERB_MAX_ECHO_TIME)
+ ALEffect->Reverb.EchoTime = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_ECHO_DEPTH:
+ if(flValue >= AL_EAXREVERB_MIN_ECHO_DEPTH &&
+ flValue <= AL_EAXREVERB_MAX_ECHO_DEPTH)
+ ALEffect->Reverb.EchoDepth = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_MODULATION_TIME:
+ if(flValue >= AL_EAXREVERB_MIN_MODULATION_TIME &&
+ flValue <= AL_EAXREVERB_MAX_MODULATION_TIME)
+ ALEffect->Reverb.ModulationTime = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_MODULATION_DEPTH:
+ if(flValue >= AL_EAXREVERB_MIN_MODULATION_DEPTH &&
+ flValue <= AL_EAXREVERB_MAX_MODULATION_DEPTH)
+ ALEffect->Reverb.ModulationDepth = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_HFREFERENCE:
+ if(flValue >= AL_EAXREVERB_MIN_HFREFERENCE &&
+ flValue <= AL_EAXREVERB_MAX_HFREFERENCE)
+ ALEffect->Reverb.HFReference = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_LFREFERENCE:
+ if(flValue >= AL_EAXREVERB_MIN_LFREFERENCE &&
+ flValue <= AL_EAXREVERB_MAX_LFREFERENCE)
+ ALEffect->Reverb.LFReference = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
+ if(flValue >= 0.0f && flValue <= 10.0f)
+ ALEffect->Reverb.RoomRolloffFactor = flValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
+ else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
@@ -426,7 +624,50 @@ ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
- if(ALEffect->type == AL_EFFECT_REVERB)
+ if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DENSITY:
+ case AL_EAXREVERB_DIFFUSION:
+ case AL_EAXREVERB_GAIN:
+ case AL_EAXREVERB_GAINHF:
+ case AL_EAXREVERB_GAINLF:
+ case AL_EAXREVERB_DECAY_TIME:
+ case AL_EAXREVERB_DECAY_HFRATIO:
+ case AL_EAXREVERB_DECAY_LFRATIO:
+ case AL_EAXREVERB_REFLECTIONS_GAIN:
+ case AL_EAXREVERB_REFLECTIONS_DELAY:
+ case AL_EAXREVERB_LATE_REVERB_GAIN:
+ case AL_EAXREVERB_LATE_REVERB_DELAY:
+ case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
+ case AL_EAXREVERB_ECHO_TIME:
+ case AL_EAXREVERB_ECHO_DEPTH:
+ case AL_EAXREVERB_MODULATION_TIME:
+ case AL_EAXREVERB_MODULATION_DEPTH:
+ case AL_EAXREVERB_HFREFERENCE:
+ case AL_EAXREVERB_LFREFERENCE:
+ case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
+ alEffectf(effect, param, pflValues[0]);
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_PAN:
+ ALEffect->Reverb.ReflectionsPan[0] = pflValues[0];
+ ALEffect->Reverb.ReflectionsPan[1] = pflValues[1];
+ ALEffect->Reverb.ReflectionsPan[2] = pflValues[2];
+ break;
+ case AL_EAXREVERB_LATE_REVERB_PAN:
+ ALEffect->Reverb.LateReverbPan[0] = pflValues[0];
+ ALEffect->Reverb.LateReverbPan[1] = pflValues[1];
+ ALEffect->Reverb.LateReverbPan[2] = pflValues[2];
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
+ else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
@@ -491,6 +732,19 @@ ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue)
{
*piValue = ALEffect->type;
}
+ else if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DECAY_HFLIMIT:
+ *piValue = ALEffect->Reverb.DecayHFLimit;
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
@@ -537,6 +791,19 @@ ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues)
{
alGetEffecti(effect, param, piValues);
}
+ else if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DECAY_HFLIMIT:
+ alGetEffecti(effect, param, piValues);
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
@@ -579,7 +846,96 @@ ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue)
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
- if(ALEffect->type == AL_EFFECT_REVERB)
+ if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DENSITY:
+ *pflValue = ALEffect->Reverb.Density;
+ break;
+
+ case AL_EAXREVERB_DIFFUSION:
+ *pflValue = ALEffect->Reverb.Diffusion;
+ break;
+
+ case AL_EAXREVERB_GAIN:
+ *pflValue = ALEffect->Reverb.Gain;
+ break;
+
+ case AL_EAXREVERB_GAINHF:
+ *pflValue = ALEffect->Reverb.GainHF;
+ break;
+
+ case AL_EAXREVERB_GAINLF:
+ *pflValue = ALEffect->Reverb.GainLF;
+ break;
+
+ case AL_EAXREVERB_DECAY_TIME:
+ *pflValue = ALEffect->Reverb.DecayTime;
+ break;
+
+ case AL_EAXREVERB_DECAY_HFRATIO:
+ *pflValue = ALEffect->Reverb.DecayHFRatio;
+ break;
+
+ case AL_EAXREVERB_DECAY_LFRATIO:
+ *pflValue = ALEffect->Reverb.DecayLFRatio;
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_GAIN:
+ *pflValue = ALEffect->Reverb.ReflectionsGain;
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_DELAY:
+ *pflValue = ALEffect->Reverb.ReflectionsDelay;
+ break;
+
+ case AL_EAXREVERB_LATE_REVERB_GAIN:
+ *pflValue = ALEffect->Reverb.LateReverbGain;
+ break;
+
+ case AL_EAXREVERB_LATE_REVERB_DELAY:
+ *pflValue = ALEffect->Reverb.LateReverbDelay;
+ break;
+
+ case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
+ *pflValue = ALEffect->Reverb.AirAbsorptionGainHF;
+ break;
+
+ case AL_EAXREVERB_ECHO_TIME:
+ *pflValue = ALEffect->Reverb.EchoTime;
+ break;
+
+ case AL_EAXREVERB_ECHO_DEPTH:
+ *pflValue = ALEffect->Reverb.EchoDepth;
+ break;
+
+ case AL_EAXREVERB_MODULATION_TIME:
+ *pflValue = ALEffect->Reverb.ModulationTime;
+ break;
+
+ case AL_EAXREVERB_MODULATION_DEPTH:
+ *pflValue = ALEffect->Reverb.ModulationDepth;
+ break;
+
+ case AL_EAXREVERB_HFREFERENCE:
+ *pflValue = ALEffect->Reverb.HFReference;
+ break;
+
+ case AL_EAXREVERB_LFREFERENCE:
+ *pflValue = ALEffect->Reverb.LFReference;
+ break;
+
+ case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
+ *pflValue = ALEffect->Reverb.RoomRolloffFactor;
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
+ else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
@@ -685,7 +1041,50 @@ ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
- if(ALEffect->type == AL_EFFECT_REVERB)
+ if(ALEffect->type == AL_EFFECT_EAXREVERB)
+ {
+ switch(param)
+ {
+ case AL_EAXREVERB_DENSITY:
+ case AL_EAXREVERB_DIFFUSION:
+ case AL_EAXREVERB_GAIN:
+ case AL_EAXREVERB_GAINHF:
+ case AL_EAXREVERB_GAINLF:
+ case AL_EAXREVERB_DECAY_TIME:
+ case AL_EAXREVERB_DECAY_HFRATIO:
+ case AL_EAXREVERB_DECAY_LFRATIO:
+ case AL_EAXREVERB_REFLECTIONS_GAIN:
+ case AL_EAXREVERB_REFLECTIONS_DELAY:
+ case AL_EAXREVERB_LATE_REVERB_GAIN:
+ case AL_EAXREVERB_LATE_REVERB_DELAY:
+ case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
+ case AL_EAXREVERB_ECHO_TIME:
+ case AL_EAXREVERB_ECHO_DEPTH:
+ case AL_EAXREVERB_MODULATION_TIME:
+ case AL_EAXREVERB_MODULATION_DEPTH:
+ case AL_EAXREVERB_HFREFERENCE:
+ case AL_EAXREVERB_LFREFERENCE:
+ case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
+ alGetEffectf(effect, param, pflValues);
+ break;
+
+ case AL_EAXREVERB_REFLECTIONS_PAN:
+ pflValues[0] = ALEffect->Reverb.ReflectionsPan[0];
+ pflValues[1] = ALEffect->Reverb.ReflectionsPan[1];
+ pflValues[2] = ALEffect->Reverb.ReflectionsPan[2];
+ break;
+ case AL_EAXREVERB_LATE_REVERB_PAN:
+ pflValues[0] = ALEffect->Reverb.LateReverbPan[0];
+ pflValues[1] = ALEffect->Reverb.LateReverbPan[1];
+ pflValues[2] = ALEffect->Reverb.LateReverbPan[2];
+ break;
+
+ default:
+ alSetError(AL_INVALID_ENUM);
+ break;
+ }
+ }
+ else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
@@ -761,18 +1160,33 @@ static void InitEffectParams(ALeffect *effect, ALenum type)
effect->type = type;
switch(type)
{
+ case AL_EFFECT_EAXREVERB:
case AL_EFFECT_REVERB:
effect->Reverb.Density = 1.0f;
effect->Reverb.Diffusion = 1.0f;
effect->Reverb.Gain = 0.32f;
effect->Reverb.GainHF = 0.89f;
+ effect->Reverb.GainLF = 1.0f;
effect->Reverb.DecayTime = 1.49f;
effect->Reverb.DecayHFRatio = 0.83f;
+ effect->Reverb.DecayLFRatio = 1.0f;
effect->Reverb.ReflectionsGain = 0.05f;
effect->Reverb.ReflectionsDelay = 0.007f;
+ effect->Reverb.ReflectionsPan[0] = 0.0f;
+ effect->Reverb.ReflectionsPan[1] = 0.0f;
+ effect->Reverb.ReflectionsPan[2] = 0.0f;
effect->Reverb.LateReverbGain = 1.26f;
effect->Reverb.LateReverbDelay = 0.011f;
+ effect->Reverb.LateReverbPan[0] = 0.0f;
+ effect->Reverb.LateReverbPan[1] = 0.0f;
+ effect->Reverb.LateReverbPan[2] = 0.0f;
+ effect->Reverb.EchoTime = 0.25f;
+ effect->Reverb.EchoDepth = 0.0f;
+ effect->Reverb.ModulationTime = 0.25f;
+ effect->Reverb.ModulationDepth = 0.0f;
effect->Reverb.AirAbsorptionGainHF = 0.994f;
+ effect->Reverb.HFReference = 5000.0f;
+ effect->Reverb.LFReference = 250.0f;
effect->Reverb.RoomRolloffFactor = 0.0f;
effect->Reverb.DecayHFLimit = AL_TRUE;
break;