diff options
-rw-r--r-- | Alc/ALu.c | 8 | ||||
-rw-r--r-- | OpenAL32/Include/alListener.h | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 2 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 4 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 15 | ||||
-rw-r--r-- | OpenAL32/alState.c | 9 |
6 files changed, 11 insertions, 33 deletions
@@ -278,10 +278,6 @@ static void CalcListenerParams(ALCcontext *Context) Listener->Params.SpeedOfSound = ATOMIC_LOAD(&props->SpeedOfSound, almemory_order_relaxed) * ATOMIC_LOAD(&props->DopplerVelocity, almemory_order_relaxed); - Listener->Params.SourceDistanceModel = ATOMIC_LOAD(&props->SourceDistanceModel, - almemory_order_relaxed); - Listener->Params.DistanceModel = ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed); - /* WARNING: A livelock is theoretically possible if another thread keeps * changing the freelist head without giving this a chance to actually swap * in the old container (practically impossible with this little code, @@ -941,9 +937,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro Attenuation = 1.0f; for(i = 0;i < NumSends;i++) RoomAttenuation[i] = 1.0f; - switch(Listener->Params.SourceDistanceModel ? - ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed) : - Listener->Params.DistanceModel) + switch(ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed)) { case InverseDistanceClamped: ClampedDist = clampf(ClampedDist, MinDist, MaxDist); diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 3008f7bc..a10d6728 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -20,9 +20,6 @@ struct ALlistenerProps { ATOMIC(ALfloat) DopplerVelocity; ATOMIC(ALfloat) SpeedOfSound; - ATOMIC(ALboolean) SourceDistanceModel; - ATOMIC(enum DistanceModel) DistanceModel; - ATOMIC(struct ALlistenerProps*) next; }; @@ -52,9 +49,6 @@ typedef struct ALlistener { ALfloat DopplerFactor; ALfloat SpeedOfSound; - - ALboolean SourceDistanceModel; - enum DistanceModel DistanceModel; } Params; } ALlistener; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 4a15cea1..fbd63ce2 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -205,7 +205,7 @@ inline struct ALsource *LookupSource(ALCcontext *context, ALuint id) inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id) { return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); } -void UpdateSourceProps(ALsource *source, ALuint num_sends); +void UpdateSourceProps(ALsource *source, ALuint num_sends, ALCcontext *context); void UpdateAllSourceProps(ALCcontext *context); ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state); ALboolean ApplyOffset(ALsource *Source); diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index c59d644b..c7f4955a 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -514,10 +514,6 @@ void UpdateListenerProps(ALCcontext *context) ATOMIC_STORE(&props->DopplerVelocity, context->DopplerVelocity, almemory_order_relaxed); ATOMIC_STORE(&props->SpeedOfSound, context->SpeedOfSound, almemory_order_relaxed); - ATOMIC_STORE(&props->SourceDistanceModel, context->SourceDistanceModel, - almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, context->DistanceModel, almemory_order_relaxed); - /* Set the new container for updating internal parameters. */ props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &listener->Update, props, almemory_order_acq_rel); if(props) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 090b4659..780e9061 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -385,7 +385,7 @@ static ALint Int64ValsByProp(ALenum prop) #define DO_UPDATEPROPS() do { \ if(SourceShouldUpdate(Source, Context)) \ - UpdateSourceProps(Source, device->NumAuxSends); \ + UpdateSourceProps(Source, device->NumAuxSends, Context); \ } while(0) static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values) @@ -834,7 +834,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p /* We must force an update if the auxiliary slot changed on a * playing source, in case the slot is about to be deleted. */ - UpdateSourceProps(Source, device->NumAuxSends); + UpdateSourceProps(Source, device->NumAuxSends, Context); } else { @@ -2750,7 +2750,7 @@ static ALvoid DeinitSource(ALsource *source) } } -void UpdateSourceProps(ALsource *source, ALuint num_sends) +void UpdateSourceProps(ALsource *source, ALuint num_sends, ALCcontext *context) { struct ALsourceProps *props; size_t i; @@ -2795,7 +2795,10 @@ void UpdateSourceProps(ALsource *source, ALuint num_sends) } ATOMIC_STORE(&props->HeadRelative, source->HeadRelative, almemory_order_relaxed); ATOMIC_STORE(&props->Looping, source->Looping, almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, source->DistanceModel, almemory_order_relaxed); + ATOMIC_STORE(&props->DistanceModel, + context->SourceDistanceModel ? source->DistanceModel : context->DistanceModel, + almemory_order_relaxed + ); ATOMIC_STORE(&props->DirectChannels, source->DirectChannels, almemory_order_relaxed); ATOMIC_STORE(&props->DryGainHFAuto, source->DryGainHFAuto, almemory_order_relaxed); @@ -2863,7 +2866,7 @@ void UpdateAllSourceProps(ALCcontext *context) ALsource *source = voice->Source; if(source != NULL && (source->state == AL_PLAYING || source->state == AL_PAUSED)) - UpdateSourceProps(source, num_sends); + UpdateSourceProps(source, num_sends, context); } /* Now with all updates declared, let the mixer continue applying them so * they all happen at once. @@ -2965,7 +2968,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) } } - UpdateSourceProps(Source, device->NumAuxSends); + UpdateSourceProps(Source, device->NumAuxSends, Context); } else if(state == AL_PAUSED) { diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index e8a8d391..443ab884 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -63,10 +63,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - { - UpdateListenerProps(context); UpdateAllSourceProps(context); - } done: WriteUnlock(&context->PropLock); @@ -91,10 +88,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - { - UpdateListenerProps(context); UpdateAllSourceProps(context); - } done: WriteUnlock(&context->PropLock); @@ -637,10 +631,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value) if(!context->SourceDistanceModel) { if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - { - UpdateListenerProps(context); UpdateAllSourceProps(context); - } } WriteUnlock(&context->PropLock); |