diff options
author | Chris Robinson <[email protected]> | 2011-07-11 01:05:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-07-11 01:05:42 -0700 |
commit | 58466a304b24e86c507f16d07fdbec051d2ada14 (patch) | |
tree | a40c6aace264c46abb9ba34ba2da7990101875a9 /OpenAL32/alState.c | |
parent | 51c09e94b84d386b51d130a540a2669a514061bb (diff) |
Use a flag to signifiy that all sources need updating
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r-- | OpenAL32/alState.c | 80 |
1 files changed, 6 insertions, 74 deletions
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); } |