aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp18
-rw-r--r--OpenAL32/alError.cpp8
-rw-r--r--OpenAL32/alListener.cpp10
-rw-r--r--OpenAL32/alSource.cpp16
-rw-r--r--OpenAL32/alState.cpp10
-rw-r--r--OpenAL32/event.cpp12
6 files changed, 37 insertions, 37 deletions
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index 9c11720e..ff0f7eaa 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -618,7 +618,7 @@ static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontex
newarray->count = newcount;
}
- curarray = ATOMIC_EXCHANGE(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel);
+ curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1))
althrd_yield();
al_free(curarray);
@@ -653,7 +653,7 @@ static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcon
/* TODO: Could reallocate newarray now that we know it's needed size. */
- curarray = ATOMIC_EXCHANGE(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel);
+ curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1))
althrd_yield();
al_free(curarray);
@@ -693,16 +693,16 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context)
ALeffectState *oldstate;
/* Get an unused property container, or allocate a new one as needed. */
- props = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed);
+ props = context->FreeEffectslotProps.load(std::memory_order_relaxed);
if(!props)
props = static_cast<ALeffectslotProps*>(al_calloc(16, sizeof(*props)));
else
{
struct ALeffectslotProps *next;
do {
- next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->FreeEffectslotProps, &props, next,
- almemory_order_seq_cst, almemory_order_acquire) == 0);
+ next = props->next.load(std::memory_order_relaxed);
+ } while(context->FreeEffectslotProps.compare_exchange_weak(props, next,
+ std::memory_order_seq_cst, std::memory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -719,7 +719,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context)
props->State = slot->Effect.State;
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(&slot->Update, props, almemory_order_acq_rel);
+ props = slot->Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
@@ -741,11 +741,11 @@ void UpdateAllEffectSlotProps(ALCcontext *context)
ALsizei i;
LockEffectSlotList(context);
- auxslots = ATOMIC_LOAD(&context->ActiveAuxSlots, almemory_order_acquire);
+ auxslots = context->ActiveAuxSlots.load(std::memory_order_acquire);
for(i = 0;i < auxslots->count;i++)
{
ALeffectslot *slot = auxslots->slot[i];
- if(!ATOMIC_EXCHANGE(&slot->PropsClean, AL_TRUE, almemory_order_acq_rel))
+ if(!slot->PropsClean.exchange(AL_TRUE, std::memory_order_acq_rel))
UpdateEffectSlotProps(slot, context);
}
UnlockEffectSlotList(context);
diff --git a/OpenAL32/alError.cpp b/OpenAL32/alError.cpp
index 6d8ca882..16c89273 100644
--- a/OpenAL32/alError.cpp
+++ b/OpenAL32/alError.cpp
@@ -70,11 +70,11 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
}
ALenum curerr{AL_NO_ERROR};
- ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&context->LastError, &curerr, errorCode);
- if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Error))
+ context->LastError.compare_exchange_strong(curerr, errorCode);
+ if((context->EnabledEvts.load(std::memory_order_relaxed)&EventType_Error))
{
std::lock_guard<almtx_t> _{context->EventCbLock};
- ALbitfieldSOFT enabledevts{ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)};
+ ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)};
if((enabledevts&EventType_Error) && context->EventCb)
(*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg,
context->EventParam);
@@ -100,5 +100,5 @@ AL_API ALenum AL_APIENTRY alGetError(void)
return deferror;
}
- return ATOMIC_EXCHANGE_SEQ(&context->LastError, AL_NO_ERROR);
+ return context->LastError.exchange(AL_NO_ERROR);
}
diff --git a/OpenAL32/alListener.cpp b/OpenAL32/alListener.cpp
index 574f897c..bf1ac3f9 100644
--- a/OpenAL32/alListener.cpp
+++ b/OpenAL32/alListener.cpp
@@ -461,16 +461,16 @@ void UpdateListenerProps(ALCcontext *context)
struct ALlistenerProps *props;
/* Get an unused proprty container, or allocate a new one as needed. */
- props = ATOMIC_LOAD(&context->FreeListenerProps, almemory_order_acquire);
+ props = context->FreeListenerProps.load(std::memory_order_acquire);
if(!props)
props = static_cast<ALlistenerProps*>(al_calloc(16, sizeof(*props)));
else
{
struct ALlistenerProps *next;
do {
- next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->FreeListenerProps, &props, next,
- almemory_order_seq_cst, almemory_order_acquire) == 0);
+ next = props->next.load(std::memory_order_relaxed);
+ } while(context->FreeListenerProps.compare_exchange_weak(props, next,
+ std::memory_order_seq_cst, std::memory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -492,7 +492,7 @@ void UpdateListenerProps(ALCcontext *context)
props->Gain = listener->Gain;
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(&listener->Update, props, almemory_order_acq_rel);
+ props = listener->Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index ac220a2e..ea83d578 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -2488,9 +2488,9 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
if(vidx == -1)
vidx = context->VoiceCount++;
voice = context->Voices[vidx];
- ATOMIC_STORE(&voice->Playing, false, almemory_order_release);
+ voice->Playing.store(false, std::memory_order_release);
- ATOMIC_EXCHANGE(&source->PropsClean, AL_TRUE, almemory_order_acquire);
+ source->PropsClean.exchange(AL_TRUE, std::memory_order_acquire);
UpdateSourceProps(source, voice, device->NumAuxSends, context);
/* A source that's not playing or paused has any offset applied when it
@@ -3157,7 +3157,7 @@ static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_send
ALsizei i;
/* Get an unused property container, or allocate a new one as needed. */
- props = ATOMIC_LOAD(&context->FreeVoiceProps, almemory_order_acquire);
+ props = context->FreeVoiceProps.load(std::memory_order_acquire);
if(!props)
props = static_cast<ALvoiceProps*>(al_calloc(16,
FAM_SIZE(struct ALvoiceProps, Send, num_sends)));
@@ -3165,9 +3165,9 @@ static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_send
{
struct ALvoiceProps *next;
do {
- next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->FreeVoiceProps, &props, next,
- almemory_order_acq_rel, almemory_order_acquire) == 0);
+ next = props->next.load(std::memory_order_relaxed);
+ } while(context->FreeVoiceProps.compare_exchange_weak(props, next,
+ std::memory_order_acq_rel, std::memory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -3230,7 +3230,7 @@ static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_send
}
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(&voice->Update, props, almemory_order_acq_rel);
+ props = voice->Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
@@ -3249,7 +3249,7 @@ void UpdateAllSourceProps(ALCcontext *context)
{
ALvoice *voice = context->Voices[pos];
ALsource *source = ATOMIC_LOAD(&voice->Source, almemory_order_acquire);
- if(source && !ATOMIC_EXCHANGE(&source->PropsClean, AL_TRUE, almemory_order_acq_rel))
+ if(source && !source->PropsClean.exchange(AL_TRUE, std::memory_order_acq_rel))
UpdateSourceProps(source, voice, num_sends, context);
}
}
diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp
index 836853bb..a3c3cc1f 100644
--- a/OpenAL32/alState.cpp
+++ b/OpenAL32/alState.cpp
@@ -765,16 +765,16 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index)
void UpdateContextProps(ALCcontext *context)
{
/* Get an unused proprty container, or allocate a new one as needed. */
- struct ALcontextProps *props{ATOMIC_LOAD(&context->FreeContextProps, almemory_order_acquire)};
+ struct ALcontextProps *props{context->FreeContextProps.load(std::memory_order_acquire)};
if(!props)
props = static_cast<ALcontextProps*>(al_calloc(16, sizeof(*props)));
else
{
struct ALcontextProps *next;
do {
- next = ATOMIC_LOAD(&props->next, almemory_order_relaxed);
- } while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->FreeContextProps, &props, next,
- almemory_order_seq_cst, almemory_order_acquire) == 0);
+ next = props->next.load(std::memory_order_relaxed);
+ } while(context->FreeContextProps.compare_exchange_weak(props, next,
+ std::memory_order_seq_cst, std::memory_order_acquire) == 0);
}
/* Copy in current property values. */
@@ -788,7 +788,7 @@ void UpdateContextProps(ALCcontext *context)
props->mDistanceModel = context->mDistanceModel;
/* Set the new container for updating internal parameters. */
- props = ATOMIC_EXCHANGE(&context->Update, props, almemory_order_acq_rel);
+ props = context->Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp
index e4b5eee0..fcbcba66 100644
--- a/OpenAL32/event.cpp
+++ b/OpenAL32/event.cpp
@@ -107,9 +107,9 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
if(enable)
{
- ALbitfieldSOFT enabledevts{ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)};
- while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts|flags,
- almemory_order_acq_rel, almemory_order_acquire) == 0)
+ ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)};
+ while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts|flags,
+ std::memory_order_acq_rel, std::memory_order_acquire) == 0)
{
/* enabledevts is (re-)filled with the current value on failure, so
* just try again.
@@ -118,9 +118,9 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
}
else
{
- ALbitfieldSOFT enabledevts{ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)};
- while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts&~flags,
- almemory_order_acq_rel, almemory_order_acquire) == 0)
+ ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)};
+ while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts&~flags,
+ std::memory_order_acq_rel, std::memory_order_acquire) == 0)
{
}
/* Wait to ensure the event handler sees the changed flags before