summaryrefslogtreecommitdiffstats
path: root/src/audio/oal
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2020-05-04 20:06:14 +0200
committerFire-Head <Fire-Head@users.noreply.github.com>2020-05-04 20:06:14 +0200
commit0abd0c659b39805a457896427980414cdc552ff8 (patch)
tree563c6897e40b0177c647f20316fdd364ebafe2cb /src/audio/oal
parentoal upd (diff)
downloadre3-0abd0c659b39805a457896427980414cdc552ff8.tar
re3-0abd0c659b39805a457896427980414cdc552ff8.tar.gz
re3-0abd0c659b39805a457896427980414cdc552ff8.tar.bz2
re3-0abd0c659b39805a457896427980414cdc552ff8.tar.lz
re3-0abd0c659b39805a457896427980414cdc552ff8.tar.xz
re3-0abd0c659b39805a457896427980414cdc552ff8.tar.zst
re3-0abd0c659b39805a457896427980414cdc552ff8.zip
Diffstat (limited to 'src/audio/oal')
-rw-r--r--src/audio/oal/oal_utils.cpp107
1 files changed, 50 insertions, 57 deletions
diff --git a/src/audio/oal/oal_utils.cpp b/src/audio/oal/oal_utils.cpp
index a2df61c1..4119672f 100644
--- a/src/audio/oal/oal_utils.cpp
+++ b/src/audio/oal/oal_utils.cpp
@@ -39,26 +39,20 @@ LPALGETFILTERFV alGetFilterfv;
void EFXInit()
{
- if (alIsExtensionPresent((ALchar*)"EAX3.0"))
- DEV("\nBIG EAX IN TOWN\n");
- else
- DEV("\nNO EAX\n");
-
-
- /* Define a macro to help load the function pointers. */
+ /* Define a macro to help load the function pointers. */
#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x))
- LOAD_PROC(LPALGENEFFECTS, alGenEffects);
- LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects);
- LOAD_PROC(LPALISEFFECT, alIsEffect);
- LOAD_PROC(LPALEFFECTI, alEffecti);
- LOAD_PROC(LPALEFFECTIV, alEffectiv);
- LOAD_PROC(LPALEFFECTF, alEffectf);
- LOAD_PROC(LPALEFFECTFV, alEffectfv);
- LOAD_PROC(LPALGETEFFECTI, alGetEffecti);
- LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv);
- LOAD_PROC(LPALGETEFFECTF, alGetEffectf);
- LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv);
-
+ LOAD_PROC(LPALGENEFFECTS, alGenEffects);
+ LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects);
+ LOAD_PROC(LPALISEFFECT, alIsEffect);
+ LOAD_PROC(LPALEFFECTI, alEffecti);
+ LOAD_PROC(LPALEFFECTIV, alEffectiv);
+ LOAD_PROC(LPALEFFECTF, alEffectf);
+ LOAD_PROC(LPALEFFECTFV, alEffectfv);
+ LOAD_PROC(LPALGETEFFECTI, alGetEffecti);
+ LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv);
+ LOAD_PROC(LPALGETEFFECTF, alGetEffectf);
+ LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv);
+
LOAD_PROC(LPALGENFILTERS, alGenFilters);
LOAD_PROC(LPALDELETEFILTERS, alDeleteFilters);
LOAD_PROC(LPALISFILTER, alIsFilter);
@@ -70,22 +64,21 @@ void EFXInit()
LOAD_PROC(LPALGETFILTERIV, alGetFilteriv);
LOAD_PROC(LPALGETFILTERF, alGetFilterf);
LOAD_PROC(LPALGETFILTERFV, alGetFilterfv);
-
- LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots);
- LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots);
- LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot);
- LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti);
- LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv);
- LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf);
- LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv);
- LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti);
- LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv);
- LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf);
- LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv);
+
+ LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots);
+ LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots);
+ LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot);
+ LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti);
+ LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv);
+ LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf);
+ LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv);
+ LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti);
+ LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv);
+ LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf);
+ LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv);
#undef LOAD_PROC
}
-
void SetEffectsLevel(ALuint uiFilter, float level)
{
alFilteri(uiFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
@@ -103,7 +96,7 @@ static inline float mB_to_gain(float millibels)
return (millibels > -10000.0f) ? powf(10.0f, millibels/2000.0f) : 0.0f;
}
-static inline FLOAT clampF(FLOAT val, FLOAT minval, FLOAT maxval)
+static inline float clampF(float val, float minval, float maxval)
{
if(val >= maxval) return maxval;
if(val <= minval) return minval;
@@ -113,35 +106,35 @@ static inline FLOAT clampF(FLOAT val, FLOAT minval, FLOAT maxval)
void EAX3_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
{
alEffecti (effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
- alEffectf (effect, AL_EAXREVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
- alEffectf (effect, AL_EAXREVERB_DIFFUSION, props->flEnvironmentDiffusion);
- alEffectf (effect, AL_EAXREVERB_GAIN, mB_to_gain((float)props->lRoom));
- alEffectf (effect, AL_EAXREVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
- alEffectf (effect, AL_EAXREVERB_GAINLF, mB_to_gain((float)props->lRoomLF));
- alEffectf (effect, AL_EAXREVERB_DECAY_TIME, props->flDecayTime);
- alEffectf (effect, AL_EAXREVERB_DECAY_HFRATIO, props->flDecayHFRatio);
- alEffectf (effect, AL_EAXREVERB_DECAY_LFRATIO, props->flDecayLFRatio);
- alEffectf (effect, AL_EAXREVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
- alEffectf (effect, AL_EAXREVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
- alEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, &props->vReflectionsPan.x);
- alEffectf (effect, AL_EAXREVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
- alEffectf (effect, AL_EAXREVERB_LATE_REVERB_DELAY, props->flReverbDelay);
- alEffectfv(effect, AL_EAXREVERB_LATE_REVERB_PAN, &props->vReverbPan.x);
- alEffectf (effect, AL_EAXREVERB_ECHO_TIME, props->flEchoTime);
- alEffectf (effect, AL_EAXREVERB_ECHO_DEPTH, props->flEchoDepth);
- alEffectf (effect, AL_EAXREVERB_MODULATION_TIME, props->flModulationTime);
- alEffectf (effect, AL_EAXREVERB_MODULATION_DEPTH, props->flModulationDepth);
- alEffectf (effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
- alEffectf (effect, AL_EAXREVERB_HFREFERENCE, props->flHFReference);
- alEffectf (effect, AL_EAXREVERB_LFREFERENCE, props->flLFReference);
- alEffectf (effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
- alEffecti (effect, AL_EAXREVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
+ alEffectf (effect, AL_EAXREVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
+ alEffectf (effect, AL_EAXREVERB_DIFFUSION, props->flEnvironmentDiffusion);
+ alEffectf (effect, AL_EAXREVERB_GAIN, mB_to_gain((float)props->lRoom));
+ alEffectf (effect, AL_EAXREVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
+ alEffectf (effect, AL_EAXREVERB_GAINLF, mB_to_gain((float)props->lRoomLF));
+ alEffectf (effect, AL_EAXREVERB_DECAY_TIME, props->flDecayTime);
+ alEffectf (effect, AL_EAXREVERB_DECAY_HFRATIO, props->flDecayHFRatio);
+ alEffectf (effect, AL_EAXREVERB_DECAY_LFRATIO, props->flDecayLFRatio);
+ alEffectf (effect, AL_EAXREVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
+ alEffectf (effect, AL_EAXREVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
+ alEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, &props->vReflectionsPan.x);
+ alEffectf (effect, AL_EAXREVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
+ alEffectf (effect, AL_EAXREVERB_LATE_REVERB_DELAY, props->flReverbDelay);
+ alEffectfv(effect, AL_EAXREVERB_LATE_REVERB_PAN, &props->vReverbPan.x);
+ alEffectf (effect, AL_EAXREVERB_ECHO_TIME, props->flEchoTime);
+ alEffectf (effect, AL_EAXREVERB_ECHO_DEPTH, props->flEchoDepth);
+ alEffectf (effect, AL_EAXREVERB_MODULATION_TIME, props->flModulationTime);
+ alEffectf (effect, AL_EAXREVERB_MODULATION_DEPTH, props->flModulationDepth);
+ alEffectf (effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
+ alEffectf (effect, AL_EAXREVERB_HFREFERENCE, props->flHFReference);
+ alEffectf (effect, AL_EAXREVERB_LFREFERENCE, props->flLFReference);
+ alEffectf (effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
+ alEffecti (effect, AL_EAXREVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
}
void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
{
alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
-
+
alEffectf(effect, AL_REVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
alEffectf(effect, AL_REVERB_DIFFUSION, props->flEnvironmentDiffusion);
alEffectf(effect, AL_REVERB_GAIN, mB_to_gain((float)props->lRoom));