diff options
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 86 | ||||
-rw-r--r-- | al/buffer.cpp | 40 | ||||
-rw-r--r-- | al/effect.cpp | 22 | ||||
-rw-r--r-- | al/error.cpp | 16 | ||||
-rw-r--r-- | al/event.cpp | 50 | ||||
-rw-r--r-- | al/extension.cpp | 2 | ||||
-rw-r--r-- | al/filter.cpp | 22 | ||||
-rw-r--r-- | al/listener.cpp | 58 | ||||
-rw-r--r-- | al/source.cpp | 208 | ||||
-rw-r--r-- | al/state.cpp | 130 |
10 files changed, 317 insertions, 317 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 605923dd..880c970d 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -54,9 +54,9 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept ALuint lidx = (id-1) >> 6; ALsizei slidx = (id-1) & 0x3f; - if(UNLIKELY(lidx >= context->EffectSlotList.size())) + if(UNLIKELY(lidx >= context->mEffectSlotList.size())) return nullptr; - EffectSlotSubList &sublist{context->EffectSlotList[lidx]}; + EffectSlotSubList &sublist{context->mEffectSlotList[lidx]}; if(UNLIKELY(sublist.FreeMask & (1_u64 << slidx))) return nullptr; return sublist.EffectSlots + slidx; @@ -79,7 +79,7 @@ inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) noexcept void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) { if(count < 1) return; - ALeffectslotArray *curarray{context->ActiveAuxSlots.load(std::memory_order_acquire)}; + ALeffectslotArray *curarray{context->mActiveAuxSlots.load(std::memory_order_acquire)}; size_t newcount{curarray->size() + count}; /* Insert the new effect slots into the head of the array, followed by the @@ -114,8 +114,8 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont curarray = nullptr; } - curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); - ALCdevice *device{context->Device}; + curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); + ALCdevice *device{context->mDevice}; while((device->MixCount.load(std::memory_order_acquire)&1)) std::this_thread::yield(); delete curarray; @@ -124,7 +124,7 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) { if(count < 1) return; - ALeffectslotArray *curarray{context->ActiveAuxSlots.load(std::memory_order_acquire)}; + ALeffectslotArray *curarray{context->mActiveAuxSlots.load(std::memory_order_acquire)}; /* Don't shrink the allocated array size since we don't know how many (if * any) of the effect slots to remove are in the array. @@ -150,8 +150,8 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c curarray = nullptr; } - curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); - ALCdevice *device{context->Device}; + curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel); + ALCdevice *device{context->mDevice}; while((device->MixCount.load(std::memory_order_acquire)&1)) std::this_thread::yield(); delete curarray; @@ -160,22 +160,22 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c ALeffectslot *AllocEffectSlot(ALCcontext *context) { - ALCdevice *device{context->Device}; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; - if(context->NumEffectSlots >= device->AuxiliaryEffectSlotMax) + ALCdevice *device{context->mDevice}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; + if(context->mNumEffectSlots >= device->AuxiliaryEffectSlotMax) { alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u effect slot limit", device->AuxiliaryEffectSlotMax); return nullptr; } - auto sublist = std::find_if(context->EffectSlotList.begin(), context->EffectSlotList.end(), + auto sublist = std::find_if(context->mEffectSlotList.begin(), context->mEffectSlotList.end(), [](const EffectSlotSubList &entry) noexcept -> bool { return entry.FreeMask != 0; } ); - auto lidx = static_cast<ALsizei>(std::distance(context->EffectSlotList.begin(), sublist)); + auto lidx = static_cast<ALsizei>(std::distance(context->mEffectSlotList.begin(), sublist)); ALeffectslot *slot; ALsizei slidx; - if(LIKELY(sublist != context->EffectSlotList.end())) + if(LIKELY(sublist != context->mEffectSlotList.end())) { slidx = CTZ64(sublist->FreeMask); slot = sublist->EffectSlots + slidx; @@ -185,19 +185,19 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context) /* Don't allocate so many list entries that the 32-bit ID could * overflow... */ - if(UNLIKELY(context->EffectSlotList.size() >= 1<<25)) + if(UNLIKELY(context->mEffectSlotList.size() >= 1<<25)) { alSetError(context, AL_OUT_OF_MEMORY, "Too many effect slots allocated"); return nullptr; } - context->EffectSlotList.emplace_back(); - sublist = context->EffectSlotList.end() - 1; + context->mEffectSlotList.emplace_back(); + sublist = context->mEffectSlotList.end() - 1; sublist->FreeMask = ~0_u64; sublist->EffectSlots = static_cast<ALeffectslot*>(al_calloc(16, sizeof(ALeffectslot)*64)); if(UNLIKELY(!sublist->EffectSlots)) { - context->EffectSlotList.pop_back(); + context->mEffectSlotList.pop_back(); alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect slot batch"); return nullptr; } @@ -219,7 +219,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context) /* Add 1 to avoid source ID 0. */ slot->id = ((lidx<<6) | slidx) + 1; - context->NumEffectSlots += 1; + context->mNumEffectSlots += 1; sublist->FreeMask &= ~(1_u64 << slidx); return slot; @@ -233,13 +233,13 @@ void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot) al::destroy_at(slot); - context->EffectSlotList[lidx].FreeMask |= 1_u64 << slidx; - context->NumEffectSlots--; + context->mEffectSlotList[lidx].FreeMask |= 1_u64 << slidx; + context->mNumEffectSlots--; } #define DO_UPDATEPROPS() do { \ - if(!context->DeferUpdates.load(std::memory_order_acquire)) \ + if(!context->mDeferUpdates.load(std::memory_order_acquire)) \ UpdateEffectSlotProps(slot, context.get()); \ else \ slot->PropsClean.clear(std::memory_order_release); \ @@ -295,7 +295,7 @@ START_API_FUNC std::copy(tempids.cbegin(), tempids.cend(), effectslots); } - std::unique_lock<std::mutex> slotlock{context->EffectSlotLock}; + std::unique_lock<std::mutex> slotlock{context->mEffectSlotLock}; AddActiveEffectSlots(effectslots, n, context.get()); } END_API_FUNC @@ -310,7 +310,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Deleting %d effect slots", n); if(n == 0) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; auto effectslots_end = effectslots + n; auto bad_slot = std::find_if(effectslots, effectslots_end, [&context](ALuint id) -> bool @@ -350,7 +350,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(LIKELY(context)) { - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; if(LookupEffectSlot(context.get(), effectslot) != nullptr) return AL_TRUE; } @@ -365,8 +365,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -377,7 +377,7 @@ START_API_FUNC switch(param) { case AL_EFFECTSLOT_EFFECT: - device = context->Device; + device = context->mDevice; { std::lock_guard<std::mutex> ___{device->EffectLock}; ALeffect *effect{value ? LookupEffect(device, value) : nullptr}; @@ -453,7 +453,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -473,8 +473,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -508,7 +508,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -529,7 +529,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -566,7 +566,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -586,7 +586,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -617,7 +617,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->EffectSlotLock}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); if(UNLIKELY(!slot)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); @@ -647,7 +647,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect if(!State) return AL_OUT_OF_MEMORY; FPUCtl mixer_mode{}; - ALCdevice *Device{Context->Device}; + ALCdevice *Device{Context->mDevice}; std::unique_lock<std::mutex> statelock{Device->StateLock}; State->mOutTarget = Device->Dry.Buffer; if(State->deviceUpdate(Device) == AL_FALSE) @@ -677,7 +677,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect EffectSlot->Effect.Props = effect->Props; /* Remove state references from old effect slot property updates. */ - ALeffectslotProps *props{Context->FreeEffectslotProps.load()}; + ALeffectslotProps *props{Context->mFreeEffectslotProps.load()}; while(props) { if(props->State) @@ -739,7 +739,7 @@ ALeffectslot::~ALeffectslot() void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) { /* Get an unused property container, or allocate a new one as needed. */ - ALeffectslotProps *props{context->FreeEffectslotProps.load(std::memory_order_relaxed)}; + ALeffectslotProps *props{context->mFreeEffectslotProps.load(std::memory_order_relaxed)}; if(!props) props = static_cast<ALeffectslotProps*>(al_calloc(16, sizeof(*props))); else @@ -747,7 +747,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) ALeffectslotProps *next; do { next = props->next.load(std::memory_order_relaxed); - } while(context->FreeEffectslotProps.compare_exchange_weak(props, next, + } while(context->mFreeEffectslotProps.compare_exchange_weak(props, next, std::memory_order_seq_cst, std::memory_order_acquire) == 0); } @@ -775,7 +775,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) if(props->State) props->State->DecRef(); props->State = nullptr; - AtomicReplaceHead(context->FreeEffectslotProps, props); + AtomicReplaceHead(context->mFreeEffectslotProps, props); } if(oldstate) @@ -784,8 +784,8 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) void UpdateAllEffectSlotProps(ALCcontext *context) { - std::lock_guard<std::mutex> _{context->EffectSlotLock}; - ALeffectslotArray *auxslots{context->ActiveAuxSlots.load(std::memory_order_acquire)}; + std::lock_guard<std::mutex> _{context->mEffectSlotLock}; + ALeffectslotArray *auxslots{context->mActiveAuxSlots.load(std::memory_order_acquire)}; for(ALeffectslot *slot : *auxslots) { if(!slot->PropsClean.test_and_set(std::memory_order_acq_rel)) diff --git a/al/buffer.cpp b/al/buffer.cpp index 8b9c67e0..d4f2d179 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -247,7 +247,7 @@ constexpr ALbitfieldSOFT INVALID_MAP_FLAGS{~unsigned(AL_MAP_READ_BIT_SOFT | AL_M ALbuffer *AllocBuffer(ALCcontext *context) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->BufferLock}; auto sublist = std::find_if(device->BufferList.begin(), device->BufferList.end(), [](const BufferSubList &entry) noexcept -> bool @@ -657,7 +657,7 @@ START_API_FUNC if(UNLIKELY(n == 0)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; /* First try to find any buffers that are invalid or in-use. */ @@ -700,7 +700,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(LIKELY(context)) { - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(!buffer || LookupBuffer(device, buffer)) return AL_TRUE; @@ -721,7 +721,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -755,7 +755,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return nullptr; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -807,7 +807,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -830,7 +830,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -862,7 +862,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -992,7 +992,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1012,7 +1012,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1031,7 +1031,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1053,7 +1053,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -1088,7 +1088,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1118,7 +1118,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -1156,7 +1156,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); @@ -1178,7 +1178,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1206,7 +1206,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) @@ -1228,7 +1228,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); if(UNLIKELY(!albuf)) @@ -1273,7 +1273,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; if(UNLIKELY(LookupBuffer(device, buffer) == nullptr)) alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer); @@ -1308,7 +1308,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device = context->Device; + ALCdevice *device = context->mDevice; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); if(UNLIKELY(!albuf)) diff --git a/al/effect.cpp b/al/effect.cpp index b6cd5463..b6291129 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -139,7 +139,7 @@ void InitEffectParams(ALeffect *effect, ALenum type) ALeffect *AllocEffect(ALCcontext *context) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; auto sublist = std::find_if(device->EffectList.begin(), device->EffectList.end(), [](const EffectSubList &entry) noexcept -> bool @@ -270,7 +270,7 @@ START_API_FUNC if(UNLIKELY(n == 0)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; /* First try to find any effects that are invalid. */ @@ -308,7 +308,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(LIKELY(context)) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; if(!effect || LookupEffect(device, effect)) return AL_TRUE; @@ -323,7 +323,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; @@ -373,7 +373,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; @@ -393,7 +393,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; @@ -413,7 +413,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; @@ -433,7 +433,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; @@ -465,7 +465,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; @@ -485,7 +485,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; @@ -505,7 +505,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; diff --git a/al/error.cpp b/al/error.cpp index f5f0801e..f5ec9f52 100644 --- a/al/error.cpp +++ b/al/error.cpp @@ -82,14 +82,14 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) } ALenum curerr{AL_NO_ERROR}; - context->LastError.compare_exchange_strong(curerr, errorCode); - if((context->EnabledEvts.load(std::memory_order_relaxed)&EventType_Error)) + context->mLastError.compare_exchange_strong(curerr, errorCode); + if((context->mEnabledEvts.load(std::memory_order_relaxed)&EventType_Error)) { - std::lock_guard<std::mutex> _{context->EventCbLock}; - 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); + std::lock_guard<std::mutex> _{context->mEventCbLock}; + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + if((enabledevts&EventType_Error) && context->mEventCb) + (*context->mEventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg, + context->mEventParam); } } @@ -113,6 +113,6 @@ START_API_FUNC return deferror; } - return context->LastError.exchange(AL_NO_ERROR); + return context->mLastError.exchange(AL_NO_ERROR); } END_API_FUNC diff --git a/al/event.cpp b/al/event.cpp index b103d0da..b2710561 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -31,18 +31,18 @@ static int EventThread(ALCcontext *context) { - RingBuffer *ring{context->AsyncEvents.get()}; + RingBuffer *ring{context->mAsyncEvents.get()}; bool quitnow{false}; while(LIKELY(!quitnow)) { auto evt_data = ring->getReadVector().first; if(evt_data.len == 0) { - context->EventSem.wait(); + context->mEventSem.wait(); continue; } - std::lock_guard<std::mutex> _{context->EventCbLock}; + std::lock_guard<std::mutex> _{context->mEventCbLock}; do { auto &evt = *reinterpret_cast<AsyncEvent*>(evt_data.buf); evt_data.buf += sizeof(AsyncEvent); @@ -69,8 +69,8 @@ static int EventThread(ALCcontext *context) continue; } - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_acquire)}; - if(!context->EventCb) continue; + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_acquire)}; + if(!context->mEventCb) continue; if(evt.EnumType == EventType_SourceStateChange) { @@ -82,9 +82,9 @@ static int EventThread(ALCcontext *context) (evt.u.srcstate.state==AL_PLAYING) ? "AL_PLAYING" : (evt.u.srcstate.state==AL_PAUSED) ? "AL_PAUSED" : (evt.u.srcstate.state==AL_STOPPED) ? "AL_STOPPED" : "<unknown>"; - context->EventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id, + context->mEventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id, evt.u.srcstate.state, static_cast<ALsizei>(msg.length()), msg.c_str(), - context->EventParam); + context->mEventParam); } else if(evt.EnumType == EventType_BufferCompleted) { @@ -93,14 +93,14 @@ static int EventThread(ALCcontext *context) std::string msg{std::to_string(evt.u.bufcomp.count)}; if(evt.u.bufcomp.count == 1) msg += " buffer completed"; else msg += " buffers completed"; - context->EventCb(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, evt.u.bufcomp.id, + context->mEventCb(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, evt.u.bufcomp.id, evt.u.bufcomp.count, static_cast<ALsizei>(msg.length()), msg.c_str(), - context->EventParam); + context->mEventParam); } else if((enabledevts&evt.EnumType) == evt.EnumType) - context->EventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, + context->mEventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, static_cast<ALsizei>(strlen(evt.u.user.msg)), evt.u.user.msg, - context->EventParam); + context->mEventParam); } while(evt_data.len != 0); } return 0; @@ -109,7 +109,7 @@ static int EventThread(ALCcontext *context) void StartEventThrd(ALCcontext *ctx) { try { - ctx->EventThread = std::thread{EventThread, ctx}; + ctx->mEventThread = std::thread{EventThread, ctx}; } catch(std::exception& e) { ERR("Failed to start event thread: %s\n", e.what()); @@ -122,7 +122,7 @@ void StartEventThrd(ALCcontext *ctx) void StopEventThrd(ALCcontext *ctx) { static constexpr AsyncEvent kill_evt{EventType_KillThread}; - RingBuffer *ring{ctx->AsyncEvents.get()}; + RingBuffer *ring{ctx->mAsyncEvents.get()}; auto evt_data = ring->getWriteVector().first; if(evt_data.len == 0) { @@ -134,9 +134,9 @@ void StopEventThrd(ALCcontext *ctx) new (evt_data.buf) AsyncEvent{kill_evt}; ring->writeAdvance(1); - ctx->EventSem.post(); - if(ctx->EventThread.joinable()) - ctx->EventThread.join(); + ctx->mEventSem.post(); + if(ctx->mEventThread.joinable()) + ctx->mEventThread.join(); } AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) @@ -176,8 +176,8 @@ START_API_FUNC if(enable) { - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)}; - while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts|flags, + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + while(context->mEnabledEvts.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 @@ -187,15 +187,15 @@ START_API_FUNC } else { - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)}; - while(context->EnabledEvts.compare_exchange_weak(enabledevts, enabledevts&~flags, + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + while(context->mEnabledEvts.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 * returning. */ - std::lock_guard<std::mutex>{context->EventCbLock}; + std::lock_guard<std::mutex>{context->mEventCbLock}; } } END_API_FUNC @@ -206,9 +206,9 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->EventCbLock}; - context->EventCb = callback; - context->EventParam = userParam; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mEventCbLock}; + context->mEventCb = callback; + context->mEventParam = userParam; } END_API_FUNC diff --git a/al/extension.cpp b/al/extension.cpp index e38d4382..c190ad03 100644 --- a/al/extension.cpp +++ b/al/extension.cpp @@ -43,7 +43,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_VALUE, AL_FALSE, "NULL pointer"); size_t len{strlen(extName)}; - const char *ptr{context->ExtensionList}; + const char *ptr{context->mExtensionList}; while(ptr && *ptr) { if(strncasecmp(ptr, extName, len) == 0 && diff --git a/al/filter.cpp b/al/filter.cpp index 405842f3..d9fce069 100644 --- a/al/filter.cpp +++ b/al/filter.cpp @@ -279,7 +279,7 @@ void InitFilterParams(ALfilter *filter, ALenum type) ALfilter *AllocFilter(ALCcontext *context) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; auto sublist = std::find_if(device->FilterList.begin(), device->FilterList.end(), [](const FilterSubList &entry) noexcept -> bool @@ -411,7 +411,7 @@ START_API_FUNC if(UNLIKELY(n == 0)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; /* First try to find any filters that are invalid. */ @@ -449,7 +449,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(LIKELY(context)) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; if(!filter || LookupFilter(device, filter)) return AL_TRUE; @@ -465,7 +465,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -503,7 +503,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -523,7 +523,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -543,7 +543,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -563,7 +563,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -595,7 +595,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -615,7 +615,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; @@ -635,7 +635,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; diff --git a/al/listener.cpp b/al/listener.cpp index d67bf072..ba0a7268 100644 --- a/al/listener.cpp +++ b/al/listener.cpp @@ -36,7 +36,7 @@ #define DO_UPDATEPROPS() do { \ - if(!context->DeferUpdates.load(std::memory_order_acquire)) \ + if(!context->mDeferUpdates.load(std::memory_order_acquire)) \ UpdateListenerProps(context.get()); \ else \ listener.PropsClean.clear(std::memory_order_release); \ @@ -49,8 +49,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) { case AL_GAIN: @@ -64,11 +64,11 @@ START_API_FUNC if(!(value >= AL_MIN_METERS_PER_UNIT && value <= AL_MAX_METERS_PER_UNIT)) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Listener meters per unit out of range"); - context->MetersPerUnit = value; - if(!context->DeferUpdates.load(std::memory_order_acquire)) + context->mMetersPerUnit = value; + if(!context->mDeferUpdates.load(std::memory_order_acquire)) UpdateContextProps(context.get()); else - context->PropsClean.clear(std::memory_order_release); + context->mPropsClean.clear(std::memory_order_release); break; default: @@ -83,8 +83,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) { case AL_POSITION: @@ -133,8 +133,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!values) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "NULL pointer"); switch(param) { @@ -165,7 +165,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) { default: @@ -188,7 +188,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) { default: @@ -225,7 +225,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -243,8 +243,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!value) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -254,7 +254,7 @@ START_API_FUNC break; case AL_METERS_PER_UNIT: - *value = context->MetersPerUnit; + *value = context->mMetersPerUnit; break; default: @@ -269,8 +269,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!value1 || !value2 || !value3) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -312,8 +312,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -341,7 +341,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!value) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -358,8 +358,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!value1 || !value2 || !value3) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -396,8 +396,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - ALlistener &listener = context->Listener; - std::lock_guard<std::mutex> _{context->PropLock}; + ALlistener &listener = context->mListener; + std::lock_guard<std::mutex> _{context->mPropLock}; if(!values) alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer"); else switch(param) @@ -422,7 +422,7 @@ END_API_FUNC void UpdateListenerProps(ALCcontext *context) { /* Get an unused proprty container, or allocate a new one as needed. */ - ALlistenerProps *props{context->FreeListenerProps.load(std::memory_order_acquire)}; + ALlistenerProps *props{context->mFreeListenerProps.load(std::memory_order_acquire)}; if(!props) props = static_cast<ALlistenerProps*>(al_calloc(16, sizeof(*props))); else @@ -430,12 +430,12 @@ void UpdateListenerProps(ALCcontext *context) ALlistenerProps *next; do { next = props->next.load(std::memory_order_relaxed); - } while(context->FreeListenerProps.compare_exchange_weak(props, next, + } while(context->mFreeListenerProps.compare_exchange_weak(props, next, std::memory_order_seq_cst, std::memory_order_acquire) == 0); } /* Copy in current property values. */ - ALlistener &listener = context->Listener; + ALlistener &listener = context->mListener; props->Position = listener.Position; props->Velocity = listener.Velocity; props->OrientAt = listener.OrientAt; @@ -449,6 +449,6 @@ void UpdateListenerProps(ALCcontext *context) /* If there was an unused update container, put it back in the * freelist. */ - AtomicReplaceHead(context->FreeListenerProps, props); + AtomicReplaceHead(context->mFreeListenerProps, props); } } diff --git a/al/source.cpp b/al/source.cpp index b4582e6b..39b635a4 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -77,10 +77,10 @@ using namespace std::placeholders; inline ALvoice *GetSourceVoice(ALsource *source, ALCcontext *context) { ALint idx{source->VoiceIdx}; - if(idx >= 0 && static_cast<ALuint>(idx) < context->VoiceCount.load(std::memory_order_relaxed)) + if(idx >= 0 && static_cast<ALuint>(idx) < context->mVoiceCount.load(std::memory_order_relaxed)) { ALuint sid{source->id}; - ALvoice &voice = (*context->Voices)[idx]; + ALvoice &voice = (*context->mVoices)[idx]; if(voice.mSourceID.load(std::memory_order_acquire) == sid) return &voice; } @@ -91,7 +91,7 @@ inline ALvoice *GetSourceVoice(ALsource *source, ALCcontext *context) void UpdateSourceProps(const ALsource *source, ALvoice *voice, ALCcontext *context) { /* Get an unused property container, or allocate a new one as needed. */ - ALvoiceProps *props{context->FreeVoiceProps.load(std::memory_order_acquire)}; + ALvoiceProps *props{context->mFreeVoiceProps.load(std::memory_order_acquire)}; if(!props) props = new ALvoiceProps{}; else @@ -99,7 +99,7 @@ void UpdateSourceProps(const ALsource *source, ALvoice *voice, ALCcontext *conte ALvoiceProps *next; do { next = props->next.load(std::memory_order_relaxed); - } while(context->FreeVoiceProps.compare_exchange_weak(props, next, + } while(context->mFreeVoiceProps.compare_exchange_weak(props, next, std::memory_order_acq_rel, std::memory_order_acquire) == 0); } @@ -164,7 +164,7 @@ void UpdateSourceProps(const ALsource *source, ALvoice *voice, ALCcontext *conte /* If there was an unused update container, put it back in the * freelist. */ - AtomicReplaceHead(context->FreeVoiceProps, props); + AtomicReplaceHead(context->mFreeVoiceProps, props); } } @@ -176,7 +176,7 @@ void UpdateSourceProps(const ALsource *source, ALvoice *voice, ALCcontext *conte */ int64_t GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono::nanoseconds *clocktime) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; const ALbufferlistitem *Current; uint64_t readPos; ALuint refcount; @@ -222,7 +222,7 @@ int64_t GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono */ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono::nanoseconds *clocktime) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; const ALbufferlistitem *Current; uint64_t readPos; ALuint refcount; @@ -282,7 +282,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono:: */ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; const ALbufferlistitem *Current; ALuint readPos; ALsizei readPosFrac; @@ -484,21 +484,21 @@ ALboolean ApplyOffset(ALsource *Source, ALvoice *voice) ALsource *AllocSource(ALCcontext *context) { - ALCdevice *device{context->Device}; - std::lock_guard<std::mutex> _{context->SourceLock}; - if(context->NumSources >= device->SourcesMax) + ALCdevice *device{context->mDevice}; + std::lock_guard<std::mutex> _{context->mSourceLock}; + if(context->mNumSources >= device->SourcesMax) { alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax); return nullptr; } - auto sublist = std::find_if(context->SourceList.begin(), context->SourceList.end(), + auto sublist = std::find_if(context->mSourceList.begin(), context->mSourceList.end(), [](const SourceSubList &entry) noexcept -> bool { return entry.FreeMask != 0; } ); - auto lidx = static_cast<ALsizei>(std::distance(context->SourceList.begin(), sublist)); + auto lidx = static_cast<ALsizei>(std::distance(context->mSourceList.begin(), sublist)); ALsource *source; ALsizei slidx; - if(LIKELY(sublist != context->SourceList.end())) + if(LIKELY(sublist != context->mSourceList.end())) { slidx = CTZ64(sublist->FreeMask); source = sublist->Sources + slidx; @@ -508,19 +508,19 @@ ALsource *AllocSource(ALCcontext *context) /* Don't allocate so many list entries that the 32-bit ID could * overflow... */ - if(UNLIKELY(context->SourceList.size() >= 1<<25)) + if(UNLIKELY(context->mSourceList.size() >= 1<<25)) { alSetError(context, AL_OUT_OF_MEMORY, "Too many sources allocated"); return nullptr; } - context->SourceList.emplace_back(); - sublist = context->SourceList.end() - 1; + context->mSourceList.emplace_back(); + sublist = context->mSourceList.end() - 1; sublist->FreeMask = ~0_u64; sublist->Sources = static_cast<ALsource*>(al_calloc(16, sizeof(ALsource)*64)); if(UNLIKELY(!sublist->Sources)) { - context->SourceList.pop_back(); + context->mSourceList.pop_back(); alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate source batch"); return nullptr; } @@ -534,7 +534,7 @@ ALsource *AllocSource(ALCcontext *context) /* Add 1 to avoid source ID 0. */ source->id = ((lidx<<6) | slidx) + 1; - context->NumSources += 1; + context->mNumSources += 1; sublist->FreeMask &= ~(1_u64 << slidx); return source; @@ -546,7 +546,7 @@ void FreeSource(ALCcontext *context, ALsource *source) ALsizei lidx = id >> 6; ALsizei slidx = id & 0x3f; - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; BackendUniqueLock backlock{*device->Backend}; if(ALvoice *voice{GetSourceVoice(source, context)}) { @@ -565,8 +565,8 @@ void FreeSource(ALCcontext *context, ALsource *source) al::destroy_at(source); - context->SourceList[lidx].FreeMask |= 1_u64 << slidx; - context->NumSources--; + context->mSourceList[lidx].FreeMask |= 1_u64 << slidx; + context->mNumSources--; } @@ -575,9 +575,9 @@ inline ALsource *LookupSource(ALCcontext *context, ALuint id) noexcept ALuint lidx = (id-1) >> 6; ALsizei slidx = (id-1) & 0x3f; - if(UNLIKELY(lidx >= context->SourceList.size())) + if(UNLIKELY(lidx >= context->mSourceList.size())) return nullptr; - SourceSubList &sublist{context->SourceList[lidx]}; + SourceSubList &sublist{context->mSourceList[lidx]}; if(UNLIKELY(sublist.FreeMask & (1_u64 << slidx))) return nullptr; return sublist.Sources + slidx; @@ -614,9 +614,9 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept ALuint lidx = (id-1) >> 6; ALsizei slidx = (id-1) & 0x3f; - if(UNLIKELY(lidx >= context->EffectSlotList.size())) + if(UNLIKELY(lidx >= context->mEffectSlotList.size())) return nullptr; - EffectSlotSubList &sublist{context->EffectSlotList[lidx]}; + EffectSlotSubList &sublist{context->mEffectSlotList[lidx]}; if(UNLIKELY(sublist.FreeMask & (1_u64 << slidx))) return nullptr; return sublist.EffectSlots + slidx; @@ -715,7 +715,7 @@ inline ALenum GetSourceState(ALsource *source, ALvoice *voice) */ inline bool SourceShouldUpdate(ALsource *source, ALCcontext *context) { - return !context->DeferUpdates.load(std::memory_order_acquire) && + return !context->mDeferUpdates.load(std::memory_order_acquire) && IsPlayingOrPaused(source); } @@ -723,14 +723,14 @@ inline bool SourceShouldUpdate(ALsource *source, ALCcontext *context) /** Can only be called while the mixer is locked! */ void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state) { - ALbitfieldSOFT enabledevt{context->EnabledEvts.load(std::memory_order_acquire)}; + ALbitfieldSOFT enabledevt{context->mEnabledEvts.load(std::memory_order_acquire)}; if(!(enabledevt&EventType_SourceStateChange)) return; /* The mixer may have queued a state change that's not yet been processed, * and we don't want state change messages to occur out of order, so send * it through the async queue to ensure proper ordering. */ - RingBuffer *ring{context->AsyncEvents.get()}; + RingBuffer *ring{context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len < 1) return; @@ -738,7 +738,7 @@ void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state) evt->u.srcstate.id = id; evt->u.srcstate.state = state; ring->writeAdvance(1); - context->EventSem.post(); + context->mEventSem.post(); } @@ -1127,7 +1127,7 @@ ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, co if(IsPlayingOrPaused(Source)) { - ALCdevice *device{Context->Device}; + ALCdevice *device{Context->mDevice}; BackendLockGuard _{*device->Backend}; /* Double-check that the source is still playing while we have * the lock. @@ -1230,7 +1230,7 @@ ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, co ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values) { - ALCdevice *device{Context->Device}; + ALCdevice *device{Context->mDevice}; ALbuffer *buffer{nullptr}; ALfilter *filter{nullptr}; ALeffectslot *slot{nullptr}; @@ -1348,7 +1348,7 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co if(IsPlayingOrPaused(Source)) { - ALCdevice *device{Context->Device}; + ALCdevice *device{Context->mDevice}; BackendLockGuard _{*device->Backend}; if(ALvoice *voice{GetSourceVoice(Source, Context)}) { @@ -1423,7 +1423,7 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co *values == AL_EXPONENT_DISTANCE_CLAMPED); Source->mDistanceModel = static_cast<DistanceModel>(*values); - if(Context->SourceDistanceModel) + if(Context->mSourceDistanceModel) UpdateSourceProps(Source, Context); return AL_TRUE; @@ -1443,7 +1443,7 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co case AL_AUXILIARY_SEND_FILTER: - slotlock = std::unique_lock<std::mutex>{Context->EffectSlotLock}; + slotlock = std::unique_lock<std::mutex>{Context->mEffectSlotLock}; if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != nullptr)) SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u", values[0]); @@ -1664,7 +1664,7 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALdouble *values) { - ALCdevice *device{Context->Device}; + ALCdevice *device{Context->mDevice}; ClockLatency clocktime; std::chrono::nanoseconds srcclock; ALint ivals[3]; @@ -1997,7 +1997,7 @@ ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64SOFT *values) { - ALCdevice *device = Context->Device; + ALCdevice *device = Context->mDevice; ClockLatency clocktime; std::chrono::nanoseconds srcclock; ALdouble dvals[6]; @@ -2172,7 +2172,7 @@ START_API_FUNC if(n < 0) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Deleting %d sources", n); - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; /* Check that all Sources are valid */ const ALuint *sources_end = sources + n; @@ -2207,7 +2207,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(LIKELY(context)) { - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; if(LookupSource(context.get(), source) != nullptr) return AL_TRUE; } @@ -2222,8 +2222,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2240,8 +2240,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2261,8 +2261,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2282,8 +2282,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2303,8 +2303,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2325,8 +2325,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2357,8 +2357,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2375,8 +2375,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2396,8 +2396,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2417,8 +2417,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2435,8 +2435,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2456,8 +2456,8 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; - std::lock_guard<std::mutex> __{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; + std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2477,7 +2477,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2500,7 +2500,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2527,7 +2527,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2558,7 +2558,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2577,7 +2577,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2604,7 +2604,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2624,7 +2624,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2643,7 +2643,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2670,7 +2670,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2690,7 +2690,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2709,7 +2709,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2736,7 +2736,7 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; if(UNLIKELY(!Source)) alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source); @@ -2774,7 +2774,7 @@ START_API_FUNC srchandles = extra_sources.data(); } - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; for(ALsizei i{0};i < n;i++) { srchandles[i] = LookupSource(context.get(), sources[i]); @@ -2782,7 +2782,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]); } - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; BackendLockGuard __{*device->Backend}; /* If the device is disconnected, go right to stopped. */ if(UNLIKELY(!device->Connected.load(std::memory_order_acquire))) @@ -2800,9 +2800,9 @@ START_API_FUNC } /* Count the number of reusable voices. */ - auto voices_end = context->Voices->begin() + - context->VoiceCount.load(std::memory_order_relaxed); - auto free_voices = std::accumulate(context->Voices->begin(), voices_end, ALsizei{0}, + auto voices_end = context->mVoices->begin() + + context->mVoiceCount.load(std::memory_order_relaxed); + auto free_voices = std::accumulate(context->mVoices->begin(), voices_end, ALsizei{0}, [](const ALsizei count, const ALvoice &voice) noexcept -> ALsizei { if(voice.mPlayState.load(std::memory_order_acquire) == ALvoice::Stopped && @@ -2815,23 +2815,23 @@ START_API_FUNC { /* Increment the number of voices to handle the request. */ const ALuint need_voices{static_cast<ALuint>(n) - free_voices}; - const size_t rem_voices{context->Voices->size() - - context->VoiceCount.load(std::memory_order_relaxed)}; + const size_t rem_voices{context->mVoices->size() - + context->mVoiceCount.load(std::memory_order_relaxed)}; if(UNLIKELY(need_voices > rem_voices)) { /* Allocate more voices to get enough. */ const size_t alloc_count{need_voices - rem_voices}; - if(UNLIKELY(context->Voices->size() > std::numeric_limits<ALsizei>::max()-alloc_count)) + if(UNLIKELY(context->mVoices->size() > std::numeric_limits<ALsizei>::max()-alloc_count)) SETERR_RETURN(context.get(), AL_OUT_OF_MEMORY,, - "Overflow increasing voice count to %zu + %zu", context->Voices->size(), + "Overflow increasing voice count to %zu + %zu", context->mVoices->size(), alloc_count); - const size_t newcount{context->Voices->size() + alloc_count}; + const size_t newcount{context->mVoices->size() + alloc_count}; AllocateVoices(context.get(), newcount); } - context->VoiceCount.fetch_add(need_voices, std::memory_order_relaxed); + context->mVoiceCount.fetch_add(need_voices, std::memory_order_relaxed); } auto start_source = [&context,device](ALsource *source) -> void @@ -2886,9 +2886,9 @@ START_API_FUNC } /* Look for an unused voice to play this source with. */ - auto voices_end = context->Voices->begin() + - context->VoiceCount.load(std::memory_order_relaxed); - voice = std::find_if(context->Voices->begin(), voices_end, + auto voices_end = context->mVoices->begin() + + context->mVoiceCount.load(std::memory_order_relaxed); + voice = std::find_if(context->mVoices->begin(), voices_end, [](const ALvoice &voice) noexcept -> bool { return voice.mPlayState.load(std::memory_order_acquire) == ALvoice::Stopped && @@ -2896,7 +2896,7 @@ START_API_FUNC } ); assert(voice != voices_end); - auto vidx = static_cast<ALint>(std::distance(context->Voices->begin(), voice)); + auto vidx = static_cast<ALint>(std::distance(context->mVoices->begin(), voice)); voice->mPlayState.store(ALvoice::Stopped, std::memory_order_release); source->PropsClean.test_and_set(std::memory_order_acquire); @@ -3036,7 +3036,7 @@ START_API_FUNC srchandles = extra_sources.data(); } - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; for(ALsizei i{0};i < n;i++) { srchandles[i] = LookupSource(context.get(), sources[i]); @@ -3044,7 +3044,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]); } - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; BackendLockGuard __{*device->Backend}; auto pause_source = [&context](ALsource *source) -> void { @@ -3091,7 +3091,7 @@ START_API_FUNC srchandles = extra_sources.data(); } - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; for(ALsizei i{0};i < n;i++) { srchandles[i] = LookupSource(context.get(), sources[i]); @@ -3099,7 +3099,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]); } - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; BackendLockGuard __{*device->Backend}; auto stop_source = [&context](ALsource *source) -> void { @@ -3153,7 +3153,7 @@ START_API_FUNC srchandles = extra_sources.data(); } - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; for(ALsizei i{0};i < n;i++) { srchandles[i] = LookupSource(context.get(), sources[i]); @@ -3161,7 +3161,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]); } - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; BackendLockGuard __{*device->Backend}; auto rewind_source = [&context](ALsource *source) -> void { @@ -3200,7 +3200,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Queueing %d buffers", nb); if(nb == 0) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *source{LookupSource(context.get(),src)}; if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); @@ -3210,7 +3210,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src); /* Check for a valid Buffer, for its frequency and format */ - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; ALbuffer *BufferFmt{nullptr}; ALbufferlistitem *BufferList{source->queue}; while(BufferList) @@ -3319,7 +3319,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Queueing %d buffer layers", nb); if(nb == 0) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *source{LookupSource(context.get(),src)}; if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); @@ -3329,7 +3329,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src); /* Check for a valid Buffer, for its frequency and format */ - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; ALbuffer *BufferFmt{nullptr}; ALbufferlistitem *BufferList{source->queue}; while(BufferList) @@ -3429,7 +3429,7 @@ START_API_FUNC SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing %d buffers", nb); if(nb == 0) return; - std::lock_guard<std::mutex> _{context->SourceLock}; + std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *source{LookupSource(context.get(),src)}; if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); @@ -3611,9 +3611,9 @@ ALsource::~ALsource() void UpdateAllSourceProps(ALCcontext *context) { - auto voices_end = context->Voices->begin() + - context->VoiceCount.load(std::memory_order_relaxed); - std::for_each(context->Voices->begin(), voices_end, + auto voices_end = context->mVoices->begin() + + context->mVoiceCount.load(std::memory_order_relaxed); + std::for_each(context->mVoices->begin(), voices_end, [context](ALvoice &voice) -> void { ALuint sid{voice.mSourceID.load(std::memory_order_acquire)}; diff --git a/al/state.cpp b/al/state.cpp index cbb43685..b1885f5c 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -80,10 +80,10 @@ START_API_FUNC END_API_FUNC #define DO_UPDATEPROPS() do { \ - if(!context->DeferUpdates.load(std::memory_order_acquire)) \ + if(!context->mDeferUpdates.load(std::memory_order_acquire)) \ UpdateContextProps(context.get()); \ else \ - context->PropsClean.clear(std::memory_order_release); \ + context->mPropsClean.clear(std::memory_order_release); \ } while(0) @@ -93,11 +93,11 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - context->SourceDistanceModel = AL_TRUE; + context->mSourceDistanceModel = AL_TRUE; DO_UPDATEPROPS(); break; @@ -113,11 +113,11 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - context->SourceDistanceModel = AL_FALSE; + context->mSourceDistanceModel = AL_FALSE; DO_UPDATEPROPS(); break; @@ -133,12 +133,12 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return AL_FALSE; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALboolean value{AL_FALSE}; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - value = context->SourceDistanceModel; + value = context->mSourceDistanceModel; break; default: @@ -155,17 +155,17 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return AL_FALSE; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALboolean value{AL_FALSE}; switch(pname) { case AL_DOPPLER_FACTOR: - if(context->DopplerFactor != 0.0f) + if(context->mDopplerFactor != 0.0f) value = AL_TRUE; break; case AL_DOPPLER_VELOCITY: - if(context->DopplerVelocity != 0.0f) + if(context->mDopplerVelocity != 0.0f) value = AL_TRUE; break; @@ -175,17 +175,17 @@ START_API_FUNC break; case AL_SPEED_OF_SOUND: - if(context->SpeedOfSound != 0.0f) + if(context->mSpeedOfSound != 0.0f) value = AL_TRUE; break; case AL_DEFERRED_UPDATES_SOFT: - if(context->DeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates.load(std::memory_order_acquire)) value = AL_TRUE; break; case AL_GAIN_LIMIT_SOFT: - if(GAIN_MIX_MAX/context->GainBoost != 0.0f) + if(GAIN_MIX_MAX/context->mGainBoost != 0.0f) value = AL_TRUE; break; @@ -212,16 +212,16 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0.0; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALdouble value{0.0}; switch(pname) { case AL_DOPPLER_FACTOR: - value = static_cast<ALdouble>(context->DopplerFactor); + value = static_cast<ALdouble>(context->mDopplerFactor); break; case AL_DOPPLER_VELOCITY: - value = static_cast<ALdouble>(context->DopplerVelocity); + value = static_cast<ALdouble>(context->mDopplerVelocity); break; case AL_DISTANCE_MODEL: @@ -229,16 +229,16 @@ START_API_FUNC break; case AL_SPEED_OF_SOUND: - value = static_cast<ALdouble>(context->SpeedOfSound); + value = static_cast<ALdouble>(context->mSpeedOfSound); break; case AL_DEFERRED_UPDATES_SOFT: - if(context->DeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates.load(std::memory_order_acquire)) value = static_cast<ALdouble>(AL_TRUE); break; case AL_GAIN_LIMIT_SOFT: - value = static_cast<ALdouble>GAIN_MIX_MAX/context->GainBoost; + value = static_cast<ALdouble>GAIN_MIX_MAX/context->mGainBoost; break; case AL_NUM_RESAMPLERS_SOFT: @@ -263,16 +263,16 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0.0f; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALfloat value{0.0f}; switch(pname) { case AL_DOPPLER_FACTOR: - value = context->DopplerFactor; + value = context->mDopplerFactor; break; case AL_DOPPLER_VELOCITY: - value = context->DopplerVelocity; + value = context->mDopplerVelocity; break; case AL_DISTANCE_MODEL: @@ -280,16 +280,16 @@ START_API_FUNC break; case AL_SPEED_OF_SOUND: - value = context->SpeedOfSound; + value = context->mSpeedOfSound; break; case AL_DEFERRED_UPDATES_SOFT: - if(context->DeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates.load(std::memory_order_acquire)) value = static_cast<ALfloat>(AL_TRUE); break; case AL_GAIN_LIMIT_SOFT: - value = GAIN_MIX_MAX/context->GainBoost; + value = GAIN_MIX_MAX/context->mGainBoost; break; case AL_NUM_RESAMPLERS_SOFT: @@ -314,16 +314,16 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALint value{0}; switch(pname) { case AL_DOPPLER_FACTOR: - value = static_cast<ALint>(context->DopplerFactor); + value = static_cast<ALint>(context->mDopplerFactor); break; case AL_DOPPLER_VELOCITY: - value = static_cast<ALint>(context->DopplerVelocity); + value = static_cast<ALint>(context->mDopplerVelocity); break; case AL_DISTANCE_MODEL: @@ -331,16 +331,16 @@ START_API_FUNC break; case AL_SPEED_OF_SOUND: - value = static_cast<ALint>(context->SpeedOfSound); + value = static_cast<ALint>(context->mSpeedOfSound); break; case AL_DEFERRED_UPDATES_SOFT: - if(context->DeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates.load(std::memory_order_acquire)) value = static_cast<ALint>(AL_TRUE); break; case AL_GAIN_LIMIT_SOFT: - value = static_cast<ALint>(GAIN_MIX_MAX/context->GainBoost); + value = static_cast<ALint>(GAIN_MIX_MAX/context->mGainBoost); break; case AL_NUM_RESAMPLERS_SOFT: @@ -365,16 +365,16 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return 0; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; ALint64SOFT value{0}; switch(pname) { case AL_DOPPLER_FACTOR: - value = (ALint64SOFT)context->DopplerFactor; + value = (ALint64SOFT)context->mDopplerFactor; break; case AL_DOPPLER_VELOCITY: - value = (ALint64SOFT)context->DopplerVelocity; + value = (ALint64SOFT)context->mDopplerVelocity; break; case AL_DISTANCE_MODEL: @@ -382,16 +382,16 @@ START_API_FUNC break; case AL_SPEED_OF_SOUND: - value = (ALint64SOFT)context->SpeedOfSound; + value = (ALint64SOFT)context->mSpeedOfSound; break; case AL_DEFERRED_UPDATES_SOFT: - if(context->DeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates.load(std::memory_order_acquire)) value = (ALint64SOFT)AL_TRUE; break; case AL_GAIN_LIMIT_SOFT: - value = (ALint64SOFT)(GAIN_MIX_MAX/context->GainBoost); + value = (ALint64SOFT)(GAIN_MIX_MAX/context->mGainBoost); break; case AL_NUM_RESAMPLERS_SOFT: @@ -416,16 +416,16 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return nullptr; - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; void *value{nullptr}; switch(pname) { case AL_EVENT_CALLBACK_FUNCTION_SOFT: - value = reinterpret_cast<void*>(context->EventCb); + value = reinterpret_cast<void*>(context->mEventCb); break; case AL_EVENT_CALLBACK_USER_PARAM_SOFT: - value = context->EventParam; + value = context->mEventParam; break; default: @@ -650,7 +650,7 @@ START_API_FUNC break; case AL_EXTENSIONS: - value = context->ExtensionList; + value = context->mExtensionList; break; case AL_NO_ERROR: @@ -694,8 +694,8 @@ START_API_FUNC alSetError(context.get(), AL_INVALID_VALUE, "Doppler factor %f out of range", value); else { - std::lock_guard<std::mutex> _{context->PropLock}; - context->DopplerFactor = value; + std::lock_guard<std::mutex> _{context->mPropLock}; + context->mDopplerFactor = value; DO_UPDATEPROPS(); } } @@ -707,24 +707,24 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - if((context->EnabledEvts.load(std::memory_order_relaxed)&EventType_Deprecated)) + if((context->mEnabledEvts.load(std::memory_order_relaxed)&EventType_Deprecated)) { static constexpr ALCchar msg[] = "alDopplerVelocity is deprecated in AL1.1, use alSpeedOfSound"; const ALsizei msglen = static_cast<ALsizei>(strlen(msg)); - std::lock_guard<std::mutex> _{context->EventCbLock}; - ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_relaxed)}; - if((enabledevts&EventType_Deprecated) && context->EventCb) - (*context->EventCb)(AL_EVENT_TYPE_DEPRECATED_SOFT, 0, 0, msglen, msg, - context->EventParam); + std::lock_guard<std::mutex> _{context->mEventCbLock}; + ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)}; + if((enabledevts&EventType_Deprecated) && context->mEventCb) + (*context->mEventCb)(AL_EVENT_TYPE_DEPRECATED_SOFT, 0, 0, msglen, msg, + context->mEventParam); } if(!(value >= 0.0f && std::isfinite(value))) alSetError(context.get(), AL_INVALID_VALUE, "Doppler velocity %f out of range", value); else { - std::lock_guard<std::mutex> _{context->PropLock}; - context->DopplerVelocity = value; + std::lock_guard<std::mutex> _{context->mPropLock}; + context->mDopplerVelocity = value; DO_UPDATEPROPS(); } } @@ -740,8 +740,8 @@ START_API_FUNC alSetError(context.get(), AL_INVALID_VALUE, "Speed of sound %f out of range", value); else { - std::lock_guard<std::mutex> _{context->PropLock}; - context->SpeedOfSound = value; + std::lock_guard<std::mutex> _{context->mPropLock}; + context->mSpeedOfSound = value; DO_UPDATEPROPS(); } } @@ -760,9 +760,9 @@ START_API_FUNC alSetError(context.get(), AL_INVALID_VALUE, "Distance model 0x%04x out of range", value); else { - std::lock_guard<std::mutex> _{context->PropLock}; + std::lock_guard<std::mutex> _{context->mPropLock}; context->mDistanceModel = static_cast<DistanceModel>(value); - if(!context->SourceDistanceModel) + if(!context->mSourceDistanceModel) DO_UPDATEPROPS(); } } @@ -825,7 +825,7 @@ END_API_FUNC void UpdateContextProps(ALCcontext *context) { /* Get an unused proprty container, or allocate a new one as needed. */ - ALcontextProps *props{context->FreeContextProps.load(std::memory_order_acquire)}; + ALcontextProps *props{context->mFreeContextProps.load(std::memory_order_acquire)}; if(!props) props = static_cast<ALcontextProps*>(al_calloc(16, sizeof(*props))); else @@ -833,27 +833,27 @@ void UpdateContextProps(ALCcontext *context) ALcontextProps *next; do { next = props->next.load(std::memory_order_relaxed); - } while(context->FreeContextProps.compare_exchange_weak(props, next, + } while(context->mFreeContextProps.compare_exchange_weak(props, next, std::memory_order_seq_cst, std::memory_order_acquire) == 0); } /* Copy in current property values. */ - props->MetersPerUnit = context->MetersPerUnit; + props->MetersPerUnit = context->mMetersPerUnit; - props->DopplerFactor = context->DopplerFactor; - props->DopplerVelocity = context->DopplerVelocity; - props->SpeedOfSound = context->SpeedOfSound; + props->DopplerFactor = context->mDopplerFactor; + props->DopplerVelocity = context->mDopplerVelocity; + props->SpeedOfSound = context->mSpeedOfSound; - props->SourceDistanceModel = context->SourceDistanceModel; + props->SourceDistanceModel = context->mSourceDistanceModel; props->mDistanceModel = context->mDistanceModel; /* Set the new container for updating internal parameters. */ - props = context->Update.exchange(props, std::memory_order_acq_rel); + props = context->mUpdate.exchange(props, std::memory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - AtomicReplaceHead(context->FreeContextProps, props); + AtomicReplaceHead(context->mFreeContextProps, props); } } |