11 #include "backends/base.h"
12 #include "core/bformatdec.h"
13 #include "core/bs2b.h"
14 #include "core/front_stablizer.h"
15 #include "core/hrtf.h"
16 #include "core/logging.h"
17 #include "core/mastering.h"
18 #include "core/uhjfilter.h"
28 ALCdevice::ALCdevice(DeviceType type
) : DeviceBase
{type
}
31 ALCdevice::~ALCdevice()
33 TRACE("Freeing device %p\n", voidp
{this});
37 size_t count
{std::accumulate(BufferList
.cbegin(), BufferList
.cend(), size_t{0u},
38 [](size_t cur
, const BufferSubList
&sublist
) noexcept
-> size_t
39 { return cur
+ static_cast<uint
>(al::popcount(~sublist
.FreeMask
)); })};
41 WARN("%zu Buffer%s not deleted\n", count
, (count
==1)?"":"s");
43 count
= std::accumulate(EffectList
.cbegin(), EffectList
.cend(), size_t{0u},
44 [](size_t cur
, const EffectSubList
&sublist
) noexcept
-> size_t
45 { return cur
+ static_cast<uint
>(al::popcount(~sublist
.FreeMask
)); });
47 WARN("%zu Effect%s not deleted\n", count
, (count
==1)?"":"s");
49 count
= std::accumulate(FilterList
.cbegin(), FilterList
.cend(), size_t{0u},
50 [](size_t cur
, const FilterSubList
&sublist
) noexcept
-> size_t
51 { return cur
+ static_cast<uint
>(al::popcount(~sublist
.FreeMask
)); });
53 WARN("%zu Filter%s not deleted\n", count
, (count
==1)?"":"s");
56 void ALCdevice::enumerateHrtfs()
58 mHrtfList
= EnumerateHrtf(configValue
<std::string
>(nullptr, "hrtf-paths"));
59 if(auto defhrtfopt
= configValue
<std::string
>(nullptr, "default-hrtf"))
61 auto iter
= std::find(mHrtfList
.begin(), mHrtfList
.end(), *defhrtfopt
);
62 if(iter
== mHrtfList
.end())
63 WARN("Failed to find default HRTF \"%s\"\n", defhrtfopt
->c_str());
64 else if(iter
!= mHrtfList
.begin())
65 std::rotate(mHrtfList
.begin(), iter
, iter
+1);