aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-11-25 18:56:10 -0800
committerChris Robinson <[email protected]>2008-11-25 18:56:10 -0800
commit55b9ccc2deacf6870cabff704239caf2c85493fa (patch)
tree2b743e582670e48b9aa67ba830805a4e7d483d69 /OpenAL32/alSource.c
parent67d67a3bf636dc2cdaf0faf75875e0a17cb29577 (diff)
Implement AL_EXTX_source_distance_model
As with other EXTX extensions, this is subject to change and removal as the spec gets worked on
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index e130e044..f1ce4e85 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -32,7 +32,7 @@
#include "alThunk.h"
#include "alAuxEffectSlot.h"
-static ALvoid InitSourceParams(ALsource *pSource);
+static ALvoid InitSourceParams(ALCcontext *Context, ALsource *pSource);
static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOffset, ALuint updateSize);
static ALvoid ApplyOffset(ALsource *pSource, ALboolean bUpdateContext);
static ALint GetByteOffset(ALsource *pSource);
@@ -78,7 +78,7 @@ ALAPI ALvoid ALAPIENTRY alGenSources(ALsizei n,ALuint *sources)
sources[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
(*list)->source = sources[i];
- InitSourceParams(*list);
+ InitSourceParams(Context, *list);
Context->SourceCount++;
i++;
@@ -704,6 +704,19 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
alSetError(AL_INVALID_VALUE);
break;
+ case AL_DISTANCE_MODEL:
+ if(lValue == AL_NONE ||
+ lValue == AL_INVERSE_DISTANCE ||
+ lValue == AL_INVERSE_DISTANCE_CLAMPED ||
+ lValue == AL_LINEAR_DISTANCE ||
+ lValue == AL_LINEAR_DISTANCE_CLAMPED ||
+ lValue == AL_EXPONENT_DISTANCE ||
+ lValue == AL_EXPONENT_DISTANCE_CLAMPED)
+ pSource->DistanceModel = lValue;
+ else
+ alSetError(AL_INVALID_VALUE);
+ break;
+
default:
alSetError(AL_INVALID_ENUM);
break;
@@ -819,6 +832,7 @@ ALAPI void ALAPIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* plVa
case AL_DIRECT_FILTER_GAINHF_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
+ case AL_DISTANCE_MODEL:
alSourcei(source, eParam, plValues[0]);
break;
@@ -1212,6 +1226,10 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu
*plValue = (ALint)pSource->DopplerFactor;
break;
+ case AL_DISTANCE_MODEL:
+ *plValue = pSource->DistanceModel;
+ break;
+
default:
alSetError(AL_INVALID_ENUM);
break;
@@ -1326,6 +1344,7 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue
case AL_DIRECT_FILTER_GAINHF_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
+ case AL_DISTANCE_MODEL:
alGetSourcei(source, eParam, plValues);
break;
@@ -1979,7 +1998,7 @@ ALAPI ALvoid ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint
}
-static ALvoid InitSourceParams(ALsource *pSource)
+static ALvoid InitSourceParams(ALCcontext *Context, ALsource *pSource)
{
pSource->flInnerAngle = 360.0f;
pSource->flOuterAngle = 360.0f;
@@ -2010,6 +2029,8 @@ static ALvoid InitSourceParams(ALsource *pSource)
pSource->RoomRolloffFactor = 0.0f;
pSource->DopplerFactor = 1.0f;
+ pSource->DistanceModel = Context->DistanceModel;
+
pSource->state = AL_INITIAL;
pSource->lSourceType = AL_UNDETERMINED;