aboutsummaryrefslogtreecommitdiffstats
path: root/core/device.cpp
blob: a5edf63c1458056bd9affa267345b6289eb9ce17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#include "config.h"

#include "bformatdec.h"
#include "bs2b.h"
#include "device.h"
#include "front_stablizer.h"
#include "hrtf.h"
#include "mastering.h"


static_assert(std::atomic<std::chrono::nanoseconds>::is_always_lock_free);


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;
}