diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 5 | ||||
-rw-r--r-- | OpenAL32/Include/alListener.h | 6 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 4 | ||||
-rw-r--r-- | OpenAL32/alState.c | 10 |
4 files changed, 16 insertions, 9 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 85827746..28c0b46f 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -26,7 +26,7 @@ struct ALeffectStateVtable { void (*const Destruct)(ALeffectState *state); ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device); - void (*const update)(ALeffectState *state, const ALCdevice *device, const struct ALeffectslot *slot); + void (*const update)(ALeffectState *state, const ALCdevice *device, const struct ALeffectslot *slot, const union ALeffectProps *props); void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels); void (*const Delete)(void *ptr); @@ -35,7 +35,7 @@ struct ALeffectStateVtable { #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ DECLARE_THUNK(T, ALeffectState, void, Destruct) \ DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ -DECLARE_THUNK2(T, ALeffectState, void, update, const ALCdevice*, const ALeffectslot*) \ +DECLARE_THUNK3(T, ALeffectState, void, update, const ALCdevice*, const ALeffectslot*, const ALeffectProps*) \ DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \ static void T##_ALeffectState_Delete(void *ptr) \ { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \ @@ -108,7 +108,6 @@ typedef struct ALeffectslot { ALboolean AuxSendAuto; ALenum EffectType; - ALeffectProps EffectProps; ALeffectState *EffectState; ALfloat RoomRolloff; /* Added to the source's room rolloff, not multiplied. */ diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 75a3fb46..dee66720 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -20,6 +20,9 @@ struct ALlistenerProps { ATOMIC(ALfloat) DopplerVelocity; ATOMIC(ALfloat) SpeedOfSound; + ATOMIC(ALboolean) SourceDistanceModel; + ATOMIC(enum DistanceModel) DistanceModel; + ATOMIC(struct ALlistenerProps*) next; }; @@ -49,6 +52,9 @@ typedef struct ALlistener { ALfloat DopplerFactor; ALfloat SpeedOfSound; + + ALboolean SourceDistanceModel; + enum DistanceModel DistanceModel; } Params; } ALlistener; diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index b215f678..1c40c399 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -490,6 +490,10 @@ 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/alState.c b/OpenAL32/alState.c index 899dacd4..c0c2ca82 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -52,6 +52,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) context = GetContextRef(); if(!context) return; + WriteLock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -61,12 +62,10 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } - /* HACK: Force sources to update by doing a listener update */ - ReadLock(&context->PropLock); UpdateListenerProps(context); - ReadUnlock(&context->PropLock); done: + WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -77,6 +76,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) context = GetContextRef(); if(!context) return; + WriteLock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -86,12 +86,10 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } - /* HACK: Force sources to update by doing a listener update */ - ReadLock(&context->PropLock); UpdateListenerProps(context); - ReadUnlock(&context->PropLock); done: + WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } |