From 202f57552ad353912c54522605531e9737c790b0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 3 Jul 2011 19:39:19 -0700 Subject: Use a proper enum for the distance model --- Alc/ALu.c | 14 +++++++------- OpenAL32/Include/alMain.h | 4 ++-- OpenAL32/Include/alSource.h | 2 +- OpenAL32/Include/alu.h | 10 ++++++++++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index a980dc73..e7b53763 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -471,13 +471,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) switch(ALContext->SourceDistanceModel ? ALSource->DistanceModel : ALContext->DistanceModel) { - case AL_INVERSE_DISTANCE_CLAMPED: + case InverseDistanceClamped: ClampedDist=__max(ClampedDist,MinDist); ClampedDist=__min(ClampedDist,MaxDist); if(MaxDist < MinDist) break; //fall-through - case AL_INVERSE_DISTANCE: + case InverseDistance: if(MinDist > 0.0f) { if((MinDist + (Rolloff * (ClampedDist - MinDist))) > 0.0f) @@ -490,13 +490,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } break; - case AL_LINEAR_DISTANCE_CLAMPED: + case LinearDistanceClamped: ClampedDist=__max(ClampedDist,MinDist); ClampedDist=__min(ClampedDist,MaxDist); if(MaxDist < MinDist) break; //fall-through - case AL_LINEAR_DISTANCE: + case LinearDistance: if(MaxDist != MinDist) { Attenuation = 1.0f - (Rolloff*(ClampedDist-MinDist)/(MaxDist - MinDist)); @@ -509,13 +509,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } break; - case AL_EXPONENT_DISTANCE_CLAMPED: + case ExponentDistanceClamped: ClampedDist=__max(ClampedDist,MinDist); ClampedDist=__min(ClampedDist,MaxDist); if(MaxDist < MinDist) break; //fall-through - case AL_EXPONENT_DISTANCE: + case ExponentDistance: if(ClampedDist > 0.0f && MinDist > 0.0f) { Attenuation = aluPow(ClampedDist/MinDist, -Rolloff); @@ -524,7 +524,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } break; - case AL_NONE: + case DisableDistance: break; } diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 44f32e0f..26a3bf30 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -464,8 +464,8 @@ struct ALCcontext_struct ALboolean Suspended; - ALenum DistanceModel; - ALboolean SourceDistanceModel; + enum DistanceModel DistanceModel; + ALboolean SourceDistanceModel; ALfloat DopplerFactor; ALfloat DopplerVelocity; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 7f50f7ef..d6c3793f 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -45,7 +45,7 @@ typedef struct ALsource ALfloat vOrientation[3]; ALboolean bHeadRelative; ALboolean bLooping; - ALenum DistanceModel; + enum DistanceModel DistanceModel; ALboolean VirtualChannels; enum Resampler Resampler; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 9ac3b234..dfe600cb 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -94,6 +94,16 @@ enum Channel { MAXCHANNELS }; +enum DistanceModel { + InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED, + LinearDistanceClamped = AL_LINEAR_DISTANCE_CLAMPED, + ExponentDistanceClamped = AL_EXPONENT_DISTANCE_CLAMPED, + InverseDistance = AL_INVERSE_DISTANCE, + LinearDistance = AL_LINEAR_DISTANCE, + ExponentDistance = AL_EXPONENT_DISTANCE, + DisableDistance = AL_NONE +}; + #define BUFFERSIZE 4096 #define FRACTIONBITS (14) -- cgit v1.2.3