aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-18 16:54:22 -0800
committerChris Robinson <[email protected]>2007-12-18 16:54:22 -0800
commit233e6f1765824df7b5d574ea7c9ac590f501ed43 (patch)
tree5af54bc0394187bbb705f2f6e2fb8afb8f3cf550
parent9adc20e4e727bb2a9829cf9c9a970358d094b951 (diff)
Implement AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO property
-rw-r--r--Alc/ALu.c12
-rw-r--r--OpenAL32/Include/alSource.h1
-rw-r--r--OpenAL32/alSource.c14
3 files changed, 24 insertions, 3 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 170c7210..2d1ef59c 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -225,7 +225,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
InnerAngle = ALSource->flInnerAngle;
OuterAngle = ALSource->flOuterAngle;
HeadRelative = ALSource->bHeadRelative;
- OuterGainHF = (ALSource->DryGainHFAuto ? ALSource->OuterGainHF : 1.0f);
+ OuterGainHF = ALSource->OuterGainHF;
//Set working variables
DryMix = (ALfloat)(1.0f);
@@ -310,12 +310,18 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
{
ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle);
ConeVolume = (1.0f+(OuterGain-1.0f)*scale);
- DryGainHF *= (1.0f+(OuterGainHF-1.0f)*scale);
+ if(ALSource->DryGainHFAuto)
+ DryGainHF *= (1.0f+(OuterGainHF-1.0f)*scale);
+ if(ALSource->WetGainHFAuto)
+ WetGainHF *= (1.0f+(OuterGainHF-1.0f)*scale);
}
else if(Angle > OuterAngle)
{
ConeVolume = (1.0f+(OuterGain-1.0f));
- DryGainHF *= (1.0f+(OuterGainHF-1.0f));
+ if(ALSource->DryGainHFAuto)
+ DryGainHF *= (1.0f+(OuterGainHF-1.0f));
+ if(ALSource->WetGainHFAuto)
+ WetGainHF *= (1.0f+(OuterGainHF-1.0f));
}
else
ConeVolume = 1.0f;
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 1ada61df..5737bad9 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -72,6 +72,7 @@ typedef struct ALsource_struct
ALfloat LastWetSample;
ALboolean DryGainHFAuto;
+ ALboolean WetGainHFAuto;
ALfloat OuterGainHF;
ALfloat AirAbsorptionFactor;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 65bfcb22..03ae10b6 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -675,6 +675,13 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
alSetError(AL_INVALID_VALUE);
break;
+ case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
+ if(lValue == AL_TRUE || lValue == AL_FALSE)
+ pSource->WetGainHFAuto = lValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
default:
alSetError(AL_INVALID_ENUM);
break;
@@ -757,6 +764,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_GAINHF_AUTO:
alSourcei(source, eParam, plValues[0]);
break;
@@ -1103,6 +1111,10 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu
*plValue = pSource->DryGainHFAuto;
break;
+ case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
+ *plValue = pSource->WetGainHFAuto;
+ break;
+
default:
alSetError(AL_INVALID_ENUM);
break;
@@ -1214,6 +1226,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_GAINHF_AUTO:
alGetSourcei(source, eParam, plValues);
break;
@@ -1892,6 +1905,7 @@ static ALvoid InitSourceParams(ALsource *pSource)
pSource->flOuterGain = 0.0f;
pSource->DryGainHFAuto = AL_TRUE;
+ pSource->WetGainHFAuto = AL_TRUE;
pSource->AirAbsorptionFactor = 0.0f;
pSource->state = AL_INITIAL;