diff options
author | Chris Robinson <[email protected]> | 2021-11-19 20:04:10 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-11-19 20:04:10 -0800 |
commit | 0c99a6b316b7e52c12a25d50550291562430834d (patch) | |
tree | 329d296c689215a6e9a712920189e9e5e853ca42 /core | |
parent | 6e2c1b843132be98c016920d7e790aab69b64272 (diff) |
Make the backend pointer part of ALCdevice instead of DeviceBase
Diffstat (limited to 'core')
-rw-r--r-- | core/device.cpp | 16 | ||||
-rw-r--r-- | core/device.h | 8 |
2 files changed, 16 insertions, 8 deletions
diff --git a/core/device.cpp b/core/device.cpp index 9705c0ac..2766c5e4 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -1,7 +1,23 @@ #include "config.h" +#include "bformatdec.h" +#include "bs2b.h" #include "device.h" +#include "front_stablizer.h" +#include "hrtf.h" +#include "mastering.h" al::FlexArray<ContextBase*> DeviceBase::sEmptyContextArray{0u}; + + +DeviceBase::DeviceBase(DeviceType type) : Type{type}, mContexts{&sEmptyContextArray} +{ +} + +DeviceBase::~DeviceBase() +{ + auto *oldarray = mContexts.exchange(nullptr, std::memory_order_relaxed); + if(oldarray != &sEmptyContextArray) delete oldarray; +} diff --git a/core/device.h b/core/device.h index 88d146aa..194901a2 100644 --- a/core/device.h +++ b/core/device.h @@ -24,7 +24,6 @@ #include "uhjfilter.h" #include "vector.h" -struct BackendBase; class BFormatDec; struct bs2b; struct Compressor; @@ -240,13 +239,6 @@ struct DeviceBase { // Contexts created on this device std::atomic<al::FlexArray<ContextBase*>*> mContexts{nullptr}; - /* 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. - */ - std::mutex StateLock; - std::unique_ptr<BackendBase> Backend; - DeviceBase(DeviceType type); DeviceBase(const DeviceBase&) = delete; |