diff options
author | Chris Robinson <[email protected]> | 2019-07-30 09:05:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-07-30 09:05:54 -0700 |
commit | ea76e003e7f2063687ed662282d388078ecf385b (patch) | |
tree | 3f8bc57781ef077e9ef45e725bbf6cc583d6d2d6 /alc | |
parent | 488d1de9444d2866644a9e926089043186e6232b (diff) |
Properly prefix ALCcontext members
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 158 | ||||
-rw-r--r-- | alc/alcontext.h | 76 | ||||
-rw-r--r-- | alc/alu.cpp | 60 | ||||
-rw-r--r-- | alc/effects/autowah.cpp | 2 | ||||
-rw-r--r-- | alc/effects/chorus.cpp | 2 | ||||
-rw-r--r-- | alc/effects/distortion.cpp | 2 | ||||
-rw-r--r-- | alc/effects/echo.cpp | 2 | ||||
-rw-r--r-- | alc/effects/equalizer.cpp | 2 | ||||
-rw-r--r-- | alc/effects/fshifter.cpp | 2 | ||||
-rw-r--r-- | alc/effects/modulator.cpp | 2 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 4 | ||||
-rw-r--r-- | alc/effects/vmorpher.cpp | 2 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 14 |
13 files changed, 164 insertions, 164 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 538bea9f..49ecf54b 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -833,7 +833,7 @@ std::atomic<ALCenum> LastNullDeviceError{ALC_NO_ERROR}; /* Thread-local current context */ void ReleaseThreadCtx(ALCcontext *context) { - auto ref = DecrementRef(&context->ref); + auto ref = DecrementRef(&context->mRef); TRACEREF("ALCcontext %p decreasing refcount to %u\n", context, ref); ERR("Context %p current for thread being destroyed, possible leak!\n", context); } @@ -1599,7 +1599,7 @@ void SetDefaultChannelOrder(ALCdevice *device) */ void ALCcontext_DeferUpdates(ALCcontext *context) { - context->DeferUpdates.store(true); + context->mDeferUpdates.store(true); } /* ALCcontext_ProcessUpdates @@ -1608,19 +1608,19 @@ void ALCcontext_DeferUpdates(ALCcontext *context) */ void ALCcontext_ProcessUpdates(ALCcontext *context) { - std::lock_guard<std::mutex> _{context->PropLock}; - if(context->DeferUpdates.exchange(false)) + std::lock_guard<std::mutex> _{context->mPropLock}; + if(context->mDeferUpdates.exchange(false)) { /* Tell the mixer to stop applying updates, then wait for any active * updating to finish, before providing updates. */ - context->HoldUpdates.store(true, std::memory_order_release); - while((context->UpdateCount.load(std::memory_order_acquire)&1) != 0) + context->mHoldUpdates.store(true, std::memory_order_release); + while((context->mUpdateCount.load(std::memory_order_acquire)&1) != 0) std::this_thread::yield(); - if(!context->PropsClean.test_and_set(std::memory_order_acq_rel)) + if(!context->mPropsClean.test_and_set(std::memory_order_acq_rel)) UpdateContextProps(context); - if(!context->Listener.PropsClean.test_and_set(std::memory_order_acq_rel)) + if(!context->mListener.PropsClean.test_and_set(std::memory_order_acq_rel)) UpdateListenerProps(context); UpdateAllEffectSlotProps(context); UpdateAllSourceProps(context); @@ -1628,7 +1628,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) /* Now with all updates declared, let the mixer continue applying them * so they all happen at once. */ - context->HoldUpdates.store(false, std::memory_order_release); + context->mHoldUpdates.store(false, std::memory_order_release); } } @@ -2167,9 +2167,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) FPUCtl mixer_mode{}; for(ALCcontext *context : *device->mContexts.load()) { - if(context->DefaultSlot) + if(context->mDefaultSlot) { - ALeffectslot *slot = context->DefaultSlot.get(); + ALeffectslot *slot = context->mDefaultSlot.get(); aluInitEffectPanning(slot, device); EffectState *state{slot->Effect.State}; @@ -2180,9 +2180,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateEffectSlotProps(slot, context); } - std::unique_lock<std::mutex> proplock{context->PropLock}; - std::unique_lock<std::mutex> slotlock{context->EffectSlotLock}; - for(auto &sublist : context->EffectSlotList) + std::unique_lock<std::mutex> proplock{context->mPropLock}; + std::unique_lock<std::mutex> slotlock{context->mEffectSlotLock}; + for(auto &sublist : context->mEffectSlotList) { uint64_t usemask = ~sublist.FreeMask; while(usemask) @@ -2204,8 +2204,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } slotlock.unlock(); - std::unique_lock<std::mutex> srclock{context->SourceLock}; - for(auto &sublist : context->SourceList) + std::unique_lock<std::mutex> srclock{context->mSourceLock}; + for(auto &sublist : context->mSourceList) { uint64_t usemask = ~sublist.FreeMask; while(usemask) @@ -2245,7 +2245,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) * auxiliary sends is changing. Active sources will have updates * respecified in UpdateAllSourceProps. */ - ALvoiceProps *vprops{context->FreeVoiceProps.exchange(nullptr, std::memory_order_acq_rel)}; + ALvoiceProps *vprops{context->mFreeVoiceProps.exchange(nullptr, std::memory_order_acq_rel)}; while(vprops) { ALvoiceProps *next = vprops->next.load(std::memory_order_relaxed); @@ -2253,8 +2253,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) vprops = next; } - auto voices = context->Voices.get(); - auto voices_end = voices->begin() + context->VoiceCount.load(std::memory_order_relaxed); + auto voices = context->mVoices.get(); + auto voices_end = voices->begin() + context->mVoiceCount.load(std::memory_order_relaxed); if(device->NumAuxSends < old_sends) { const ALsizei num_sends{device->NumAuxSends}; @@ -2300,9 +2300,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ); srclock.unlock(); - context->PropsClean.test_and_set(std::memory_order_release); + context->mPropsClean.test_and_set(std::memory_order_release); UpdateContextProps(context); - context->Listener.PropsClean.test_and_set(std::memory_order_release); + context->mListener.PropsClean.test_and_set(std::memory_order_release); UpdateListenerProps(context); UpdateAllSourceProps(context); } @@ -2383,9 +2383,9 @@ static DeviceRef VerifyDevice(ALCdevice *device) } -ALCcontext::ALCcontext(ALCdevice *device) : Device{device} +ALCcontext::ALCcontext(ALCdevice *device) : mDevice{device} { - PropsClean.test_and_set(std::memory_order_relaxed); + mPropsClean.test_and_set(std::memory_order_relaxed); } /* InitContext @@ -2394,43 +2394,43 @@ ALCcontext::ALCcontext(ALCdevice *device) : Device{device} */ static ALvoid InitContext(ALCcontext *Context) { - ALlistener &listener = Context->Listener; + ALlistener &listener = Context->mListener; ALeffectslotArray *auxslots; //Validate Context - if(!Context->DefaultSlot) + if(!Context->mDefaultSlot) auxslots = ALeffectslot::CreatePtrArray(0); else { auxslots = ALeffectslot::CreatePtrArray(1); - (*auxslots)[0] = Context->DefaultSlot.get(); + (*auxslots)[0] = Context->mDefaultSlot.get(); } - Context->ActiveAuxSlots.store(auxslots, std::memory_order_relaxed); + Context->mActiveAuxSlots.store(auxslots, std::memory_order_relaxed); //Set globals Context->mDistanceModel = DistanceModel::Default; - Context->SourceDistanceModel = AL_FALSE; - Context->DopplerFactor = 1.0f; - Context->DopplerVelocity = 1.0f; - Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; - Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; + Context->mSourceDistanceModel = AL_FALSE; + Context->mDopplerFactor = 1.0f; + Context->mDopplerVelocity = 1.0f; + Context->mSpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; + Context->mMetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; - Context->ExtensionList = alExtList; + Context->mExtensionList = alExtList; listener.Params.Matrix = alu::Matrix::Identity(); listener.Params.Velocity = alu::Vector{}; listener.Params.Gain = listener.Gain; - listener.Params.MetersPerUnit = Context->MetersPerUnit; - listener.Params.DopplerFactor = Context->DopplerFactor; - listener.Params.SpeedOfSound = Context->SpeedOfSound * Context->DopplerVelocity; + listener.Params.MetersPerUnit = Context->mMetersPerUnit; + listener.Params.DopplerFactor = Context->mDopplerFactor; + listener.Params.SpeedOfSound = Context->mSpeedOfSound * Context->mDopplerVelocity; listener.Params.ReverbSpeedOfSound = listener.Params.SpeedOfSound * listener.Params.MetersPerUnit; - listener.Params.SourceDistanceModel = Context->SourceDistanceModel; + listener.Params.SourceDistanceModel = Context->mSourceDistanceModel; listener.Params.mDistanceModel = Context->mDistanceModel; - Context->AsyncEvents = CreateRingBuffer(511, sizeof(AsyncEvent), false); + Context->mAsyncEvents = CreateRingBuffer(511, sizeof(AsyncEvent), false); StartEventThrd(Context); } @@ -2444,14 +2444,14 @@ ALCcontext::~ALCcontext() { TRACE("Freeing context %p\n", this); - ALcontextProps *cprops{Update.exchange(nullptr, std::memory_order_relaxed)}; + ALcontextProps *cprops{mUpdate.exchange(nullptr, std::memory_order_relaxed)}; if(cprops) { TRACE("Freed unapplied context update %p\n", cprops); al_free(cprops); } size_t count{0}; - cprops = FreeContextProps.exchange(nullptr, std::memory_order_acquire); + cprops = mFreeContextProps.exchange(nullptr, std::memory_order_acquire); while(cprops) { ALcontextProps *next{cprops->next.load(std::memory_order_relaxed)}; @@ -2461,17 +2461,17 @@ ALCcontext::~ALCcontext() } TRACE("Freed %zu context property object%s\n", count, (count==1)?"":"s"); - count = std::accumulate(SourceList.cbegin(), SourceList.cend(), size_t{0u}, + count = std::accumulate(mSourceList.cbegin(), mSourceList.cend(), size_t{0u}, [](size_t cur, const SourceSubList &sublist) noexcept -> size_t { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) WARN("%zu Source%s not deleted\n", count, (count==1)?"":"s"); - SourceList.clear(); - NumSources = 0; + mSourceList.clear(); + mNumSources = 0; count = 0; - ALeffectslotProps *eprops{FreeEffectslotProps.exchange(nullptr, std::memory_order_acquire)}; + ALeffectslotProps *eprops{mFreeEffectslotProps.exchange(nullptr, std::memory_order_acquire)}; while(eprops) { ALeffectslotProps *next{eprops->next.load(std::memory_order_relaxed)}; @@ -2482,20 +2482,20 @@ ALCcontext::~ALCcontext() } TRACE("Freed %zu AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); - delete ActiveAuxSlots.exchange(nullptr, std::memory_order_relaxed); - DefaultSlot = nullptr; + delete mActiveAuxSlots.exchange(nullptr, std::memory_order_relaxed); + mDefaultSlot = nullptr; - count = std::accumulate(EffectSlotList.cbegin(), EffectSlotList.cend(), size_t{0u}, + count = std::accumulate(mEffectSlotList.cbegin(), mEffectSlotList.cend(), size_t{0u}, [](size_t cur, const EffectSlotSubList &sublist) noexcept -> size_t { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) WARN("%zu AuxiliaryEffectSlot%s not deleted\n", count, (count==1)?"":"s"); - EffectSlotList.clear(); - NumEffectSlots = 0; + mEffectSlotList.clear(); + mNumEffectSlots = 0; count = 0; - ALvoiceProps *vprops{FreeVoiceProps.exchange(nullptr, std::memory_order_acquire)}; + ALvoiceProps *vprops{mFreeVoiceProps.exchange(nullptr, std::memory_order_acquire)}; while(vprops) { ALvoiceProps *next{vprops->next.load(std::memory_order_relaxed)}; @@ -2505,17 +2505,17 @@ ALCcontext::~ALCcontext() } TRACE("Freed %zu voice property object%s\n", count, (count==1)?"":"s"); - Voices = nullptr; - VoiceCount.store(0, std::memory_order_relaxed); + mVoices = nullptr; + mVoiceCount.store(0, std::memory_order_relaxed); - ALlistenerProps *lprops{Listener.Update.exchange(nullptr, std::memory_order_relaxed)}; + ALlistenerProps *lprops{mListener.Update.exchange(nullptr, std::memory_order_relaxed)}; if(lprops) { TRACE("Freed unapplied listener update %p\n", lprops); al_free(lprops); } count = 0; - lprops = FreeListenerProps.exchange(nullptr, std::memory_order_acquire); + lprops = mFreeListenerProps.exchange(nullptr, std::memory_order_acquire); while(lprops) { ALlistenerProps *next{lprops->next.load(std::memory_order_relaxed)}; @@ -2525,10 +2525,10 @@ ALCcontext::~ALCcontext() } TRACE("Freed %zu listener property object%s\n", count, (count==1)?"":"s"); - if(AsyncEvents) + if(mAsyncEvents) { count = 0; - auto evt_vec = AsyncEvents->getReadVector(); + auto evt_vec = mAsyncEvents->getReadVector(); if(evt_vec.first.len > 0) { al::destroy_n(reinterpret_cast<AsyncEvent*>(evt_vec.first.buf), evt_vec.first.len); @@ -2541,10 +2541,10 @@ ALCcontext::~ALCcontext() } if(count > 0) TRACE("Destructed %zu orphaned event%s\n", count, (count==1)?"":"s"); - AsyncEvents->readAdvance(count); + mAsyncEvents->readAdvance(count); } - ALCdevice_DecRef(Device); + ALCdevice_DecRef(mDevice); } /* ReleaseContext @@ -2612,13 +2612,13 @@ static bool ReleaseContext(ALCcontext *context, ALCdevice *device) static void ALCcontext_IncRef(ALCcontext *context) { - auto ref = IncrementRef(&context->ref); + auto ref = IncrementRef(&context->mRef); TRACEREF("ALCcontext %p increasing refcount to %u\n", context, ref); } void ALCcontext_DecRef(ALCcontext *context) { - auto ref = DecrementRef(&context->ref); + auto ref = DecrementRef(&context->mRef); TRACEREF("ALCcontext %p decreasing refcount to %u\n", context, ref); if(UNLIKELY(ref == 0)) delete context; } @@ -2661,10 +2661,10 @@ ContextRef GetContextRef(void) void AllocateVoices(ALCcontext *context, size_t num_voices) { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; const ALsizei num_sends{device->NumAuxSends}; - if(context->Voices && num_voices == context->Voices->size()) + if(context->mVoices && num_voices == context->mVoices->size()) return; std::unique_ptr<al::FlexArray<ALvoice>> voices; @@ -2673,11 +2673,11 @@ void AllocateVoices(ALCcontext *context, size_t num_voices) voices.reset(new (ptr) al::FlexArray<ALvoice>{num_voices}); } - const size_t v_count{minz(context->VoiceCount.load(std::memory_order_relaxed), num_voices)}; - if(context->Voices) + const size_t v_count{minz(context->mVoiceCount.load(std::memory_order_relaxed), num_voices)}; + if(context->mVoices) { /* Copy the old voice data to the new storage. */ - auto viter = std::move(context->Voices->begin(), context->Voices->begin()+v_count, + auto viter = std::move(context->mVoices->begin(), context->mVoices->begin()+v_count, voices->begin()); /* Clear extraneous property set sends. */ @@ -2697,8 +2697,8 @@ void AllocateVoices(ALCcontext *context, size_t num_voices) std::for_each(voices->begin(), viter, clear_sends); } - context->Voices = std::move(voices); - context->VoiceCount.store(static_cast<ALuint>(v_count), std::memory_order_relaxed); + context->mVoices = std::move(voices); + context->mVoiceCount.store(static_cast<ALuint>(v_count), std::memory_order_relaxed); } @@ -3444,7 +3444,7 @@ START_API_FUNC dev->LastError.store(ALC_NO_ERROR); ContextRef context{new ALCcontext{dev.get()}}; - ALCdevice_IncRef(context->Device); + ALCdevice_IncRef(context->mDevice); ALCenum err{UpdateDeviceParams(dev.get(), attrList)}; if(err != ALC_NO_ERROR) @@ -3461,12 +3461,12 @@ START_API_FUNC if(DefaultEffect.type != AL_EFFECT_NULL && dev->Type == Playback) { void *ptr{al_calloc(16, sizeof(ALeffectslot))}; - context->DefaultSlot = std::unique_ptr<ALeffectslot>{new (ptr) ALeffectslot{}}; - if(InitEffectSlot(context->DefaultSlot.get()) == AL_NO_ERROR) - aluInitEffectPanning(context->DefaultSlot.get(), dev.get()); + context->mDefaultSlot = std::unique_ptr<ALeffectslot>{new (ptr) ALeffectslot{}}; + if(InitEffectSlot(context->mDefaultSlot.get()) == AL_NO_ERROR) + aluInitEffectPanning(context->mDefaultSlot.get(), dev.get()); else { - context->DefaultSlot = nullptr; + context->mDefaultSlot = nullptr; ERR("Failed to initialize the default effect slot\n"); } } @@ -3483,8 +3483,8 @@ START_API_FUNC const ALfloat db{clampf(valf, -24.0f, 24.0f)}; if(db != valf) WARN("volume-adjust clamped: %f, range: +/-%f\n", valf, 24.0f); - context->GainBoost = std::pow(10.0f, db/20.0f); - TRACE("volume-adjust gain: %f\n", context->GainBoost); + context->mGainBoost = std::pow(10.0f, db/20.0f); + TRACE("volume-adjust gain: %f\n", context->mGainBoost); } } UpdateListenerProps(context.get()); @@ -3526,10 +3526,10 @@ START_API_FUNC ContextList.insert(iter, ContextRef{context.get()}); } - if(context->DefaultSlot) + if(context->mDefaultSlot) { - if(InitializeEffect(context.get(), context->DefaultSlot.get(), &DefaultEffect) == AL_NO_ERROR) - UpdateEffectSlotProps(context->DefaultSlot.get(), context.get()); + if(InitializeEffect(context.get(), context->mDefaultSlot.get(), &DefaultEffect) == AL_NO_ERROR) + UpdateEffectSlotProps(context->mDefaultSlot.get(), context.get()); else ERR("Failed to initialize the default effect\n"); } @@ -3560,7 +3560,7 @@ START_API_FUNC ContextRef ctx{std::move(*iter)}; ContextList.erase(iter); - ALCdevice *Device{ctx->Device}; + ALCdevice *Device{ctx->mDevice}; std::lock_guard<std::mutex> _{Device->StateLock}; if(!ReleaseContext(ctx.get(), Device) && Device->Flags.get<DeviceRunning>()) @@ -3671,7 +3671,7 @@ START_API_FUNC alcSetError(nullptr, ALC_INVALID_CONTEXT); return nullptr; } - return ctx->Device; + return ctx->mDevice; } END_API_FUNC diff --git a/alc/alcontext.h b/alc/alcontext.h index a2da77b0..8156c345 100644 --- a/alc/alcontext.h +++ b/alc/alcontext.h @@ -73,70 +73,70 @@ struct EffectSlotSubList { }; struct ALCcontext { - RefCount ref{1u}; + RefCount mRef{1u}; - al::vector<SourceSubList> SourceList; - ALuint NumSources{0}; - std::mutex SourceLock; + al::vector<SourceSubList> mSourceList; + ALuint mNumSources{0}; + std::mutex mSourceLock; - al::vector<EffectSlotSubList> EffectSlotList; - ALuint NumEffectSlots{0u}; - std::mutex EffectSlotLock; + al::vector<EffectSlotSubList> mEffectSlotList; + ALuint mNumEffectSlots{0u}; + std::mutex mEffectSlotLock; - std::atomic<ALenum> LastError{AL_NO_ERROR}; + std::atomic<ALenum> mLastError{AL_NO_ERROR}; DistanceModel mDistanceModel{DistanceModel::Default}; - ALboolean SourceDistanceModel{AL_FALSE}; + ALboolean mSourceDistanceModel{AL_FALSE}; - ALfloat DopplerFactor{1.0f}; - ALfloat DopplerVelocity{1.0f}; - ALfloat SpeedOfSound{}; - ALfloat MetersPerUnit{1.0f}; + ALfloat mDopplerFactor{1.0f}; + ALfloat mDopplerVelocity{1.0f}; + ALfloat mSpeedOfSound{}; + ALfloat mMetersPerUnit{1.0f}; - std::atomic_flag PropsClean; - std::atomic<bool> DeferUpdates{false}; + std::atomic_flag mPropsClean; + std::atomic<bool> mDeferUpdates{false}; - std::mutex PropLock; + std::mutex mPropLock; /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit * indicates if updates are currently happening). */ - RefCount UpdateCount{0u}; - std::atomic<bool> HoldUpdates{false}; + RefCount mUpdateCount{0u}; + std::atomic<bool> mHoldUpdates{false}; - ALfloat GainBoost{1.0f}; + ALfloat mGainBoost{1.0f}; - std::atomic<ALcontextProps*> Update{nullptr}; + std::atomic<ALcontextProps*> mUpdate{nullptr}; /* Linked lists of unused property containers, free to use for future * updates. */ - std::atomic<ALcontextProps*> FreeContextProps{nullptr}; - std::atomic<ALlistenerProps*> FreeListenerProps{nullptr}; - std::atomic<ALvoiceProps*> FreeVoiceProps{nullptr}; - std::atomic<ALeffectslotProps*> FreeEffectslotProps{nullptr}; + std::atomic<ALcontextProps*> mFreeContextProps{nullptr}; + std::atomic<ALlistenerProps*> mFreeListenerProps{nullptr}; + std::atomic<ALvoiceProps*> mFreeVoiceProps{nullptr}; + std::atomic<ALeffectslotProps*> mFreeEffectslotProps{nullptr}; - std::unique_ptr<al::FlexArray<ALvoice>> Voices{nullptr}; - std::atomic<ALuint> VoiceCount{0u}; + std::unique_ptr<al::FlexArray<ALvoice>> mVoices{nullptr}; + std::atomic<ALuint> mVoiceCount{0u}; using ALeffectslotArray = al::FlexArray<ALeffectslot*>; - std::atomic<ALeffectslotArray*> ActiveAuxSlots{nullptr}; + std::atomic<ALeffectslotArray*> mActiveAuxSlots{nullptr}; - std::thread EventThread; - al::semaphore EventSem; - std::unique_ptr<RingBuffer> AsyncEvents; - std::atomic<ALbitfieldSOFT> EnabledEvts{0u}; - std::mutex EventCbLock; - ALEVENTPROCSOFT EventCb{}; - void *EventParam{nullptr}; + std::thread mEventThread; + al::semaphore mEventSem; + std::unique_ptr<RingBuffer> mAsyncEvents; + std::atomic<ALbitfieldSOFT> mEnabledEvts{0u}; + std::mutex mEventCbLock; + ALEVENTPROCSOFT mEventCb{}; + void *mEventParam{nullptr}; /* Default effect slot */ - std::unique_ptr<ALeffectslot> DefaultSlot; + std::unique_ptr<ALeffectslot> mDefaultSlot; - ALCdevice *const Device; - const ALCchar *ExtensionList{nullptr}; + ALCdevice *const mDevice; + const ALCchar *mExtensionList{nullptr}; - ALlistener Listener{}; + ALlistener mListener{}; ALCcontext(ALCdevice *device); diff --git a/alc/alu.cpp b/alc/alu.cpp index b2e1effa..2469d08d 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -279,10 +279,10 @@ alu::Vector operator*(const alu::Matrix &mtx, const alu::Vector &vec) noexcept bool CalcContextParams(ALCcontext *Context) { - ALcontextProps *props{Context->Update.exchange(nullptr, std::memory_order_acq_rel)}; + ALcontextProps *props{Context->mUpdate.exchange(nullptr, std::memory_order_acq_rel)}; if(!props) return false; - ALlistener &Listener = Context->Listener; + ALlistener &Listener = Context->mListener; Listener.Params.MetersPerUnit = props->MetersPerUnit; Listener.Params.DopplerFactor = props->DopplerFactor; @@ -294,13 +294,13 @@ bool CalcContextParams(ALCcontext *Context) Listener.Params.SourceDistanceModel = props->SourceDistanceModel; Listener.Params.mDistanceModel = props->mDistanceModel; - AtomicReplaceHead(Context->FreeContextProps, props); + AtomicReplaceHead(Context->mFreeContextProps, props); return true; } bool CalcListenerParams(ALCcontext *Context) { - ALlistener &Listener = Context->Listener; + ALlistener &Listener = Context->mListener; ALlistenerProps *props{Listener.Update.exchange(nullptr, std::memory_order_acq_rel)}; if(!props) return false; @@ -328,9 +328,9 @@ bool CalcListenerParams(ALCcontext *Context) const alu::Vector vel{props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f}; Listener.Params.Velocity = Listener.Params.Matrix * vel; - Listener.Params.Gain = props->Gain * Context->GainBoost; + Listener.Params.Gain = props->Gain * Context->mGainBoost; - AtomicReplaceHead(Context->FreeListenerProps, props); + AtomicReplaceHead(Context->mFreeListenerProps, props); return true; } @@ -391,14 +391,14 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) /* Otherwise, if it would be deleted, send it off with a release * event. */ - RingBuffer *ring{context->AsyncEvents.get()}; + RingBuffer *ring{context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); if(LIKELY(evt_vec.first.len > 0)) { AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_ReleaseEffectState}}; evt->u.mEffectState = oldstate; ring->writeAdvance(1); - context->EventSem.post(); + context->mEventSem.post(); } else { @@ -411,7 +411,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) } } - AtomicReplaceHead(context->FreeEffectslotProps, props); + AtomicReplaceHead(context->mFreeEffectslotProps, props); } EffectTarget output; @@ -419,7 +419,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) output = EffectTarget{&target->Wet, nullptr}; else { - ALCdevice *device{context->Device}; + ALCdevice *device{context->mDevice}; output = EffectTarget{&device->Dry, &device->RealOut}; } state->update(context, slot, &slot->Params.mEffectProps, output); @@ -960,7 +960,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const ALCcontext *ALContext) { - const ALCdevice *Device{ALContext->Device}; + const ALCdevice *Device{ALContext->mDevice}; ALeffectslot *SendSlots[MAX_SENDS]; voice->mDirect.Buffer = Device->Dry.Buffer; @@ -968,7 +968,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons { SendSlots[i] = props->Send[i].Slot; if(!SendSlots[i] && i == 0) - SendSlots[i] = ALContext->DefaultSlot.get(); + SendSlots[i] = ALContext->mDefaultSlot.get(); if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) { SendSlots[i] = nullptr; @@ -992,7 +992,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons voice->mResampler = SelectResampler(props->mResampler); /* Calculate gains */ - const ALlistener &Listener = ALContext->Listener; + const ALlistener &Listener = ALContext->mListener; ALfloat DryGain{clampf(props->Gain, props->MinGain, props->MaxGain)}; DryGain *= props->Direct.Gain * Listener.Params.Gain; DryGain = minf(DryGain, GAIN_MIX_MAX); @@ -1014,9 +1014,9 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const ALCcontext *ALContext) { - const ALCdevice *Device{ALContext->Device}; + const ALCdevice *Device{ALContext->mDevice}; const ALsizei NumSends{Device->NumAuxSends}; - const ALlistener &Listener = ALContext->Listener; + const ALlistener &Listener = ALContext->mListener; /* Set mixing buffers and get send parameters. */ voice->mDirect.Buffer = Device->Dry.Buffer; @@ -1029,7 +1029,7 @@ void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const A { SendSlots[i] = props->Send[i].Slot; if(!SendSlots[i] && i == 0) - SendSlots[i] = ALContext->DefaultSlot.get(); + SendSlots[i] = ALContext->mDefaultSlot.get(); if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) { SendSlots[i] = nullptr; @@ -1342,7 +1342,7 @@ void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) { voice->mProps = *props; - AtomicReplaceHead(context->FreeVoiceProps, props); + AtomicReplaceHead(context->mFreeVoiceProps, props); } if((voice->mProps.mSpatializeMode == SpatializeAuto && voice->mFmtChannels == FmtMono) || @@ -1355,8 +1355,8 @@ void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray *slots) { - IncrementRef(&ctx->UpdateCount); - if(LIKELY(!ctx->HoldUpdates.load(std::memory_order_acquire))) + IncrementRef(&ctx->mUpdateCount); + if(LIKELY(!ctx->mHoldUpdates.load(std::memory_order_acquire))) { bool cforce{CalcContextParams(ctx)}; bool force{CalcListenerParams(ctx) || cforce}; @@ -1365,8 +1365,8 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray *slots) { return CalcEffectSlotParams(slot, ctx, cforce) | force; } ); - std::for_each(ctx->Voices->begin(), - ctx->Voices->begin() + ctx->VoiceCount.load(std::memory_order_acquire), + std::for_each(ctx->mVoices->begin(), + ctx->mVoices->begin() + ctx->mVoiceCount.load(std::memory_order_acquire), [ctx,force](ALvoice &voice) -> void { ALuint sid{voice.mSourceID.load(std::memory_order_acquire)}; @@ -1374,14 +1374,14 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray *slots) } ); } - IncrementRef(&ctx->UpdateCount); + IncrementRef(&ctx->mUpdateCount); } void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) { ASSUME(SamplesToDo > 0); - const ALeffectslotArray *auxslots{ctx->ActiveAuxSlots.load(std::memory_order_acquire)}; + const ALeffectslotArray *auxslots{ctx->mActiveAuxSlots.load(std::memory_order_acquire)}; /* Process pending propery updates for objects on the context. */ ProcessParamUpdates(ctx, auxslots); @@ -1396,8 +1396,8 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) ); /* Process voices that have a playing source. */ - std::for_each(ctx->Voices->begin(), - ctx->Voices->begin() + ctx->VoiceCount.load(std::memory_order_acquire), + std::for_each(ctx->mVoices->begin(), + ctx->mVoices->begin() + ctx->mVoiceCount.load(std::memory_order_acquire), [SamplesToDo,ctx](ALvoice &voice) -> void { const ALvoice::State vstate{voice.mPlayState.load(std::memory_order_acquire)}; @@ -1772,16 +1772,16 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) for(ALCcontext *ctx : *device->mContexts.load()) { - const ALbitfieldSOFT enabledevt{ctx->EnabledEvts.load(std::memory_order_acquire)}; + const ALbitfieldSOFT enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)}; if((enabledevt&EventType_Disconnected)) { - RingBuffer *ring{ctx->AsyncEvents.get()}; + RingBuffer *ring{ctx->mAsyncEvents.get()}; auto evt_data = ring->getWriteVector().first; if(evt_data.len > 0) { new (evt_data.buf) AsyncEvent{evt}; ring->writeAdvance(1); - ctx->EventSem.post(); + ctx->mEventSem.post(); } } @@ -1792,8 +1792,8 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) voice.mSourceID.store(0u, std::memory_order_relaxed); voice.mPlayState.store(ALvoice::Stopped, std::memory_order_release); }; - std::for_each(ctx->Voices->begin(), - ctx->Voices->begin() + ctx->VoiceCount.load(std::memory_order_acquire), + std::for_each(ctx->mVoices->begin(), + ctx->mVoices->begin() + ctx->mVoiceCount.load(std::memory_order_acquire), stop_voice); } } diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index 298d5c96..d92e114a 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -107,7 +107,7 @@ ALboolean ALautowahState::deviceUpdate(const ALCdevice*) void ALautowahState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device{context->Device}; + const ALCdevice *device{context->mDevice}; const ALfloat ReleaseTime{clampf(props->Autowah.ReleaseTime, 0.001f, 1.0f)}; diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index 28514a9b..7a473723 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -158,7 +158,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co /* The LFO depth is scaled to be relative to the sample delay. Clamp the * delay and depth to allow enough padding for resampling. */ - const ALCdevice *device{Context->Device}; + const ALCdevice *device{Context->mDevice}; const auto frequency = static_cast<ALfloat>(device->Frequency); mDelay = maxi(float2int(props->Chorus.Delay*frequency*FRACTIONONE + 0.5f), mindelay); mDepth = minf(props->Chorus.Depth * mDelay, static_cast<ALfloat>(mDelay - mindelay)); diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp index a74575d4..79278f0d 100644 --- a/alc/effects/distortion.cpp +++ b/alc/effects/distortion.cpp @@ -64,7 +64,7 @@ ALboolean DistortionState::deviceUpdate(const ALCdevice*) void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device{context->Device}; + const ALCdevice *device{context->mDevice}; /* Store waveshaper edge settings. */ const ALfloat edge{ diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index 8e309cbb..9a43c037 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -94,7 +94,7 @@ ALboolean EchoState::deviceUpdate(const ALCdevice *Device) void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device = context->Device; + const ALCdevice *device = context->mDevice; const auto frequency = static_cast<ALfloat>(device->Frequency); mTap[0].delay = maxi(float2int(props->Echo.Delay*frequency + 0.5f), 1); diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index 0ae3a25f..25ccf264 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -112,7 +112,7 @@ ALboolean EqualizerState::deviceUpdate(const ALCdevice*) void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device = context->Device; + const ALCdevice *device = context->mDevice; auto frequency = static_cast<ALfloat>(device->Frequency); ALfloat gain, f0norm; diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index b36c53a1..9b204d2e 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -109,7 +109,7 @@ ALboolean FshifterState::deviceUpdate(const ALCdevice*) void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device{context->Device}; + const ALCdevice *device{context->mDevice}; ALfloat step{props->Fshifter.Frequency / static_cast<ALfloat>(device->Frequency)}; mPhaseStep = fastf2i(minf(step, 0.5f) * FRACTIONONE); diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index 5f28e1da..bd63c56c 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -110,7 +110,7 @@ ALboolean ModulatorState::deviceUpdate(const ALCdevice*) void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device{context->Device}; + const ALCdevice *device{context->mDevice}; const float step{props->Modulator.Frequency / static_cast<ALfloat>(device->Frequency)}; mStep = fastf2i(clampf(step*WAVEFORM_FRACONE, 0.0f, ALfloat{WAVEFORM_FRACONE-1})); diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 82b04436..bc4995ff 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -906,8 +906,8 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat * void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *Device{Context->Device}; - const ALlistener &Listener = Context->Listener; + const ALCdevice *Device{Context->mDevice}; + const ALlistener &Listener = Context->mListener; const auto frequency = static_cast<ALfloat>(Device->Frequency); /* Calculate the master filters */ diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index d1bf8587..ae8c98e1 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -210,7 +210,7 @@ ALboolean VmorpherState::deviceUpdate(const ALCdevice* /*device*/) void VmorpherState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { - const ALCdevice *device{context->Device}; + const ALCdevice *device{context->mDevice}; const ALfloat frequency{static_cast<ALfloat>(device->Frequency)}; const ALfloat step{props->Vmorpher.Rate / static_cast<ALfloat>(device->Frequency)}; mStep = fastf2i(clampf(step*WAVEFORM_FRACONE, 0.0f, ALfloat{WAVEFORM_FRACONE-1})); diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index 0d7b2cee..881759c0 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -291,10 +291,10 @@ constexpr ALshort aLawDecompressionTable[256] = { void SendSourceStoppedEvent(ALCcontext *context, ALuint id) { - ALbitfieldSOFT enabledevt{context->EnabledEvts.load(std::memory_order_acquire)}; + ALbitfieldSOFT enabledevt{context->mEnabledEvts.load(std::memory_order_acquire)}; if(!(enabledevt&EventType_SourceStateChange)) return; - RingBuffer *ring{context->AsyncEvents.get()}; + RingBuffer *ring{context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len < 1) return; @@ -303,7 +303,7 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id) evt->u.srcstate.state = AL_STOPPED; ring->writeAdvance(1); - context->EventSem.post(); + context->mEventSem.post(); } @@ -544,7 +544,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc ASSUME(SampleSize > 0); ASSUME(increment > 0); - ALCdevice *Device{Context->Device}; + ALCdevice *Device{Context->mDevice}; const ALsizei NumSends{Device->NumAuxSends}; const ALsizei IrSize{Device->mHrtf ? Device->mHrtf->irSize : 0}; @@ -929,10 +929,10 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc std::atomic_thread_fence(std::memory_order_release); /* Send any events now, after the position/buffer info was updated. */ - ALbitfieldSOFT enabledevt{Context->EnabledEvts.load(std::memory_order_acquire)}; + ALbitfieldSOFT enabledevt{Context->mEnabledEvts.load(std::memory_order_acquire)}; if(buffers_done > 0 && (enabledevt&EventType_BufferCompleted)) { - RingBuffer *ring{Context->AsyncEvents.get()}; + RingBuffer *ring{Context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); if(evt_vec.first.len > 0) { @@ -940,7 +940,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc evt->u.bufcomp.id = SourceID; evt->u.bufcomp.count = buffers_done; ring->writeAdvance(1); - Context->EventSem.post(); + Context->mEventSem.post(); } } |