aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-01 19:44:09 -0700
committerChris Robinson <[email protected]>2019-08-01 19:44:09 -0700
commit33bcced82a1e97811d4212195b6e6ca9cf2242b1 (patch)
tree9431019a2288668260e92cc1522ba686c04f6e0f /al/auxeffectslot.cpp
parent4917024c9485d5ed3362ddcb1a0d0f8ee45dfedc (diff)
Use a smart pointer for holding the context's device
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index b4e93858..912765fc 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -114,7 +114,7 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont
}
curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
- ALCdevice *device{context->mDevice};
+ ALCdevice *device{context->mDevice.get()};
while((device->MixCount.load(std::memory_order_acquire)&1))
std::this_thread::yield();
delete curarray;
@@ -150,7 +150,7 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c
}
curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
- ALCdevice *device{context->mDevice};
+ ALCdevice *device{context->mDevice.get()};
while((device->MixCount.load(std::memory_order_acquire)&1))
std::this_thread::yield();
delete curarray;
@@ -159,7 +159,7 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c
ALeffectslot *AllocEffectSlot(ALCcontext *context)
{
- ALCdevice *device{context->mDevice};
+ ALCdevice *device{context->mDevice.get()};
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
if(context->mNumEffectSlots >= device->AuxiliaryEffectSlotMax)
{
@@ -376,7 +376,7 @@ START_API_FUNC
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
- device = context->mDevice;
+ device = context->mDevice.get();
{ std::lock_guard<std::mutex> ___{device->EffectLock};
ALeffect *effect{value ? LookupEffect(device, value) : nullptr};
@@ -644,7 +644,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
if(!State) return AL_OUT_OF_MEMORY;
FPUCtl mixer_mode{};
- ALCdevice *Device{Context->mDevice};
+ ALCdevice *Device{Context->mDevice.get()};
std::unique_lock<std::mutex> statelock{Device->StateLock};
State->mOutTarget = Device->Dry.Buffer;
if(State->deviceUpdate(Device) == AL_FALSE)