From b682b7e640d8c2df3be59d8dcb9db0c89c10d5bc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 16 Nov 2024 22:26:49 -0800 Subject: [PATCH] Use the correct device variable --- al/event.cpp | 3 --- al/extension.cpp | 2 -- alc/alc.cpp | 15 +++++++-------- alc/context.h | 1 - alc/device.h | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/al/event.cpp b/al/event.cpp index 4e672c15..7ceb949c 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -3,7 +3,6 @@ #include "event.h" -#include #include #include #include @@ -12,10 +11,8 @@ #include #include #include -#include #include #include -#include #include #include "AL/al.h" diff --git a/al/extension.cpp b/al/extension.cpp index 16dc015a..061addc8 100644 --- a/al/extension.cpp +++ b/al/extension.cpp @@ -21,13 +21,11 @@ #include "config.h" #include -#include #include "AL/al.h" #include "AL/alc.h" #include "alc/context.h" -#include "alc/inprogext.h" #include "alstring.h" #include "direct_defs.h" #include "opthelpers.h" diff --git a/alc/alc.cpp b/alc/alc.cpp index fe304c3d..1c510434 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2234,20 +2234,20 @@ static size_t GetIntegerv(ALCdevice *device, ALCenum param, const al::span } /* render device */ - auto NumAttrsForDevice = [](const ALCdevice *aldev) noexcept -> uint8_t + auto NumAttrsForDevice = [device]() noexcept -> uint8_t { - if(aldev->Type == DeviceType::Loopback && aldev->FmtChans == DevFmtAmbi3D) + if(device->Type == DeviceType::Loopback && device->FmtChans == DevFmtAmbi3D) return 37; return 31; }; switch(param) { case ALC_ATTRIBUTES_SIZE: - values[0] = NumAttrsForDevice(device); + values[0] = NumAttrsForDevice(); return 1; case ALC_ALL_ATTRIBUTES: - if(values.size() >= NumAttrsForDevice(device)) + if(values.size() >= NumAttrsForDevice()) { size_t i{0}; values[i++] = ALC_MAJOR_VERSION; @@ -2555,7 +2555,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, valuespan[i++] = clock.Latency.count(); valuespan[i++] = ALC_OUTPUT_MODE_SOFT; - valuespan[i++] = al::to_underlying(device->getOutputMode1()); + valuespan[i++] = al::to_underlying(dev->getOutputMode1()); valuespan[i++] = 0; } @@ -2751,7 +2751,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin /* Allocate a new context array, which holds 1 more than the current/ * old array. */ - auto *oldarray = device->mContexts.load(); + auto *oldarray = dev->mContexts.load(); auto newarray = ContextArray::Create(oldarray->size() + 1); /* Copy the current/old context handles to the new array, appending the @@ -2809,8 +2809,7 @@ ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context) noexcept ContextRef ctx{*iter}; ContextList.erase(iter); - ALCdevice *Device{ctx->mALDevice.get()}; - + auto *Device = ctx->mALDevice.get(); std::lock_guard statelock{Device->StateLock}; ctx->deinit(); } diff --git a/alc/context.h b/alc/context.h index 1ca124e2..49398e4f 100644 --- a/alc/context.h +++ b/alc/context.h @@ -75,7 +75,6 @@ struct DebugLogEntry { struct ALCcontext final : public al::intrusive_ref, ContextBase { const al::intrusive_ptr mALDevice; - bool mPropsDirty{true}; bool mDeferUpdates{false}; diff --git a/alc/device.h b/alc/device.h index 73254d3c..f80c5e14 100644 --- a/alc/device.h +++ b/alc/device.h @@ -32,7 +32,7 @@ struct FilterSubList; using uint = unsigned int; -struct ALCdevice : public al::intrusive_ref, DeviceBase { +struct ALCdevice final : public al::intrusive_ref, DeviceBase { /* This lock protects the device state (format, update size, etc) from * being from being changed in multiple threads, or being accessed while * being changed. It's also used to serialize calls to the backend. -- 2.11.4.GIT