aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c2
-rw-r--r--Alc/ALu.c9
-rw-r--r--OpenAL32/Include/alMain.h1
-rw-r--r--OpenAL32/alListener.c47
-rw-r--r--OpenAL32/alState.c80
5 files changed, 21 insertions, 118 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b6bc15db..7aebea52 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1448,6 +1448,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ALsource_Update(source, context);
source->NeedsUpdate = AL_FALSE;
}
+ context->UpdateSources = AL_FALSE;
}
UnlockDevice(device);
@@ -1540,6 +1541,7 @@ static ALvoid InitContext(ALCcontext *pContext)
//Validate pContext
pContext->LastError = AL_NO_ERROR;
+ pContext->UpdateSources = AL_FALSE;
pContext->Suspended = AL_FALSE;
pContext->ActiveSourceCount = 0;
InitUIntMap(&pContext->SourceMap);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index c2a2c5ea..2cd9326f 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -989,6 +989,11 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ctx_end = ctx + device->NumContexts;
while(ctx != ctx_end)
{
+ ALboolean UpdateSources;
+
+ UpdateSources = (*ctx)->UpdateSources;
+ (*ctx)->UpdateSources = AL_FALSE;
+
src = (*ctx)->ActiveSources;
src_end = src + (*ctx)->ActiveSourceCount;
while(src != src_end)
@@ -1000,10 +1005,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
continue;
}
- if((*src)->NeedsUpdate)
+ if((*src)->NeedsUpdate || UpdateSources)
{
- ALsource_Update(*src, *ctx);
(*src)->NeedsUpdate = AL_FALSE;
+ ALsource_Update(*src, *ctx);
}
MixSource(*src, device, SamplesToDo);
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);
}