diff options
author | Chris Robinson <[email protected]> | 2009-11-25 16:21:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-25 16:21:47 -0800 |
commit | 658923175f65b5f1da182dced0b86fb32c5598cc (patch) | |
tree | 5e57af0f6c1574f3f9068e1fa8f484661f1b6fbc /OpenAL32/alState.c | |
parent | 877f4340ba509ed9b31b2de4bcbb11c1befaf3ed (diff) |
Update source parameters only when they need changing
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r-- | OpenAL32/alState.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 7d370766..1516bb31 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -499,45 +499,89 @@ ALAPI const ALchar* ALAPIENTRY alGetString(ALenum pname) ALAPI ALvoid ALAPIENTRY alDopplerFactor(ALfloat value) { ALCcontext *Context; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value >= 0.0f) + { Context->DopplerFactor = value; + updateSources = AL_TRUE; + } else alSetError(AL_INVALID_VALUE); + // Force updating the sources for these parameters, since even head- + // relative sources are affected + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(Context); } ALAPI ALvoid ALAPIENTRY alDopplerVelocity(ALfloat value) { ALCcontext *Context; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value > 0.0f) + { Context->DopplerVelocity=value; + updateSources = AL_TRUE; + } else alSetError(AL_INVALID_VALUE); + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(Context); } ALAPI ALvoid ALAPIENTRY alSpeedOfSound(ALfloat flSpeedOfSound) { ALCcontext *pContext; + ALboolean updateSources = AL_FALSE; pContext = GetContextSuspended(); if(!pContext) return; if(flSpeedOfSound > 0.0f) + { pContext->flSpeedOfSound = flSpeedOfSound; + updateSources = AL_TRUE; + } else alSetError(AL_INVALID_VALUE); + if(updateSources) + { + ALsource *source = pContext->Source; + while(source) + { + source->NeedsUpdate = AL_TRUE; + source = source->next; + } + } + ProcessContext(pContext); } @@ -560,7 +604,10 @@ ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value) case AL_EXPONENT_DISTANCE_CLAMPED: Context->DistanceModel = value; for(Source = Context->Source;Source != NULL;Source = Source->next) + { Source->DistanceModel = value; + Source->NeedsUpdate = AL_TRUE; + } break; default: |