aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-07-11 01:05:42 -0700
committerChris Robinson <[email protected]>2011-07-11 01:05:42 -0700
commit58466a304b24e86c507f16d07fdbec051d2ada14 (patch)
treea40c6aace264c46abb9ba34ba2da7990101875a9 /OpenAL32
parent51c09e94b84d386b51d130a540a2669a514061bb (diff)
Use a flag to signifiy that all sources need updating
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h1
-rw-r--r--OpenAL32/alListener.c47
-rw-r--r--OpenAL32/alState.c80
3 files changed, 12 insertions, 116 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 95d08483..e10201be 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -464,6 +464,7 @@ struct ALCcontext_struct
ALenum LastError;
+ ALboolean UpdateSources;
ALboolean Suspended;
enum DistanceModel DistanceModel;
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index ae830ae4..1042ebc7 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -29,7 +29,6 @@
AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flValue)
{
ALCcontext *pContext;
- ALboolean updateAll = AL_FALSE;
pContext = GetLockedContext();
if(!pContext) return;
@@ -40,7 +39,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flValue)
if(flValue >= 0.0f)
{
pContext->Listener.Gain = flValue;
- updateAll = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
}
else
alSetError(pContext, AL_INVALID_VALUE);
@@ -50,7 +49,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flValue)
if(flValue > 0.0f)
{
pContext->Listener.MetersPerUnit = flValue;
- updateAll = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
}
else
alSetError(pContext, AL_INVALID_VALUE);
@@ -61,18 +60,6 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flValue)
break;
}
- // Force updating the sources for these parameters, since even head-
- // relative sources are affected
- if(updateAll)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(pContext);
}
@@ -80,7 +67,6 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flValue)
AL_API ALvoid AL_APIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat flValue2, ALfloat flValue3)
{
ALCcontext *pContext;
- ALboolean updateWorld = AL_FALSE;
pContext = GetLockedContext();
if(!pContext) return;
@@ -91,14 +77,14 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat
pContext->Listener.Position[0] = flValue1;
pContext->Listener.Position[1] = flValue2;
pContext->Listener.Position[2] = flValue3;
- updateWorld = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
break;
case AL_VELOCITY:
pContext->Listener.Velocity[0] = flValue1;
pContext->Listener.Velocity[1] = flValue2;
pContext->Listener.Velocity[2] = flValue3;
- updateWorld = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
break;
default:
@@ -106,17 +92,6 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat
break;
}
- if(updateWorld)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- if(!source->bHeadRelative)
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(pContext);
}
@@ -124,7 +99,6 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat
AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues)
{
ALCcontext *pContext;
- ALboolean updateWorld = AL_FALSE;
if(pflValues)
{
@@ -157,7 +131,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues)
pContext->Listener.Up[0] = pflValues[3];
pContext->Listener.Up[1] = pflValues[4];
pContext->Listener.Up[2] = pflValues[5];
- updateWorld = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
break;
default:
@@ -168,17 +142,6 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues)
else
alSetError(pContext, AL_INVALID_VALUE);
- if(updateWorld)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- if(!source->bHeadRelative)
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(pContext);
}
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index bcf03e1b..8bc50989 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -43,7 +43,6 @@ static const ALchar alErrOutOfMemory[] = "Out of Memory";
AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
{
ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
Context = GetLockedContext();
if(!Context) return;
@@ -52,7 +51,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
{
case AL_SOURCE_DISTANCE_MODEL:
Context->SourceDistanceModel = AL_TRUE;
- updateSources = AL_TRUE;
+ Context->UpdateSources = AL_TRUE;
break;
default:
@@ -60,23 +59,12 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
break;
}
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(Context);
}
AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
{
ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
Context = GetLockedContext();
if(!Context) return;
@@ -85,7 +73,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
{
case AL_SOURCE_DISTANCE_MODEL:
Context->SourceDistanceModel = AL_FALSE;
- updateSources = AL_TRUE;
+ Context->UpdateSources = AL_TRUE;
break;
default:
@@ -93,16 +81,6 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
break;
}
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(Context);
}
@@ -494,7 +472,6 @@ AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname)
AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
{
ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
Context = GetLockedContext();
if(!Context) return;
@@ -502,30 +479,17 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
if(value >= 0.0f)
{
Context->DopplerFactor = value;
- updateSources = AL_TRUE;
+ Context->UpdateSources = AL_TRUE;
}
else
alSetError(Context, AL_INVALID_VALUE);
- // Force updating the sources for these parameters, since even head-
- // relative sources are affected
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(Context);
}
AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
{
ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
Context = GetLockedContext();
if(!Context) return;
@@ -533,28 +497,17 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
if(value > 0.0f)
{
Context->DopplerVelocity=value;
- updateSources = AL_TRUE;
+ Context->UpdateSources = AL_TRUE;
}
else
alSetError(Context, AL_INVALID_VALUE);
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(Context);
}
AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound)
{
ALCcontext *pContext;
- ALboolean updateSources = AL_FALSE;
pContext = GetLockedContext();
if(!pContext) return;
@@ -562,28 +515,17 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound)
if(flSpeedOfSound > 0.0f)
{
pContext->flSpeedOfSound = flSpeedOfSound;
- updateSources = AL_TRUE;
+ pContext->UpdateSources = AL_TRUE;
}
else
alSetError(pContext, AL_INVALID_VALUE);
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(pContext);
}
AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
{
ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
Context = GetLockedContext();
if(!Context) return;
@@ -598,7 +540,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
case AL_EXPONENT_DISTANCE:
case AL_EXPONENT_DISTANCE_CLAMPED:
Context->DistanceModel = value;
- updateSources = !Context->SourceDistanceModel;
+ Context->UpdateSources = AL_TRUE;
break;
default:
@@ -606,15 +548,5 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
break;
}
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
UnlockContext(Context);
}