aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c6
-rw-r--r--OpenAL32/Include/alSource.h1
-rw-r--r--OpenAL32/alSource.c14
3 files changed, 20 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a3a563c7..ccaa5fe5 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -302,7 +302,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
// Source Gain + Attenuation
DryMix = SourceVolume * flAttenuation;
- WetMix = SourceVolume * RoomAttenuation;
+ WetMix = SourceVolume * (ALSource->WetGainAuto ? RoomAttenuation : 1.0f);
// Clamp to Min/Max Gain
DryMix = __min(DryMix,MaxVolume);
@@ -320,6 +320,8 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
{
ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle);
ConeVolume = (1.0f+(OuterGain-1.0f)*scale);
+ if(ALSource->WetGainAuto)
+ WetMix *= ConeVolume;
if(ALSource->DryGainHFAuto)
DryGainHF *= (1.0f+(OuterGainHF-1.0f)*scale);
if(ALSource->WetGainHFAuto)
@@ -328,6 +330,8 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
else if(Angle > OuterAngle)
{
ConeVolume = (1.0f+(OuterGain-1.0f));
+ if(ALSource->WetGainAuto)
+ WetMix *= ConeVolume;
if(ALSource->DryGainHFAuto)
DryGainHF *= (1.0f+(OuterGainHF-1.0f));
if(ALSource->WetGainHFAuto)
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 178e310f..f54d4721 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -75,6 +75,7 @@ typedef struct ALsource_struct
ALfloat LastWetSample;
ALboolean DryGainHFAuto;
+ ALboolean WetGainAuto;
ALboolean WetGainHFAuto;
ALfloat OuterGainHF;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index db327227..2c605d42 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -683,6 +683,13 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
alSetError(AL_INVALID_VALUE);
break;
+ case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
+ if(lValue == AL_TRUE || lValue == AL_FALSE)
+ pSource->WetGainAuto = lValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
if(lValue == AL_TRUE || lValue == AL_FALSE)
pSource->WetGainHFAuto = lValue;
@@ -802,6 +809,7 @@ ALAPI void ALAPIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* plVa
case AL_REFERENCE_DISTANCE:
case AL_DIRECT_FILTER:
case AL_DIRECT_FILTER_GAINHF_AUTO:
+ case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
alSourcei(source, eParam, plValues[0]);
break;
@@ -1155,6 +1163,10 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu
*plValue = pSource->DryGainHFAuto;
break;
+ case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
+ *plValue = pSource->WetGainAuto;
+ break;
+
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
*plValue = pSource->WetGainHFAuto;
break;
@@ -1270,6 +1282,7 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue
case AL_SOURCE_TYPE:
case AL_DIRECT_FILTER:
case AL_DIRECT_FILTER_GAINHF_AUTO:
+ case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
alGetSourcei(source, eParam, plValues);
break;
@@ -1949,6 +1962,7 @@ static ALvoid InitSourceParams(ALsource *pSource)
pSource->flOuterGain = 0.0f;
pSource->DryGainHFAuto = AL_TRUE;
+ pSource->WetGainAuto = AL_TRUE;
pSource->WetGainHFAuto = AL_TRUE;
pSource->AirAbsorptionFactor = 0.0f;