diff options
author | Chris Robinson <[email protected]> | 2020-03-22 08:51:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-22 08:51:06 -0700 |
commit | 9ce182228d8be25130f3f18b2d999a9612fb18f9 (patch) | |
tree | 7b45245f55a4e77dd08d6b13faa67916f5caa285 | |
parent | 040309b9f402f9629e1a553665ce789bd530dec2 (diff) |
Avoid some pre-C++14 workarounds
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 19 | ||||
-rw-r--r-- | alc/effects/fshifter.cpp | 7 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 7 | ||||
-rw-r--r-- | alc/hrtf.cpp | 4 | ||||
-rw-r--r-- | alc/panning.cpp | 4 | ||||
-rw-r--r-- | common/almalloc.h | 8 |
7 files changed, 20 insertions, 31 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 9ce1fa65..1608cac6 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2085,7 +2085,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) case DevFmtX71: if(GetConfigValueBool(device->DeviceName.c_str(), nullptr, "front-stablizer", 0)) { - auto stablizer = al::make_unique<FrontStablizer>(); + auto stablizer = std::make_unique<FrontStablizer>(); /* Initialize band-splitting filters for the front-left and front- * right channels, with a crossover at 5khz (could be higher). */ diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 4addad1d..059ebec6 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -101,8 +101,7 @@ inline constexpr ReferenceTime operator "" _reftime(unsigned long long int n) no #define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT) #define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER) -/* TODO: This can't be constexpr in C++11. */ -inline uint32_t MaskFromTopBits(uint32_t b) noexcept +constexpr inline uint32_t MaskFromTopBits(uint32_t b) noexcept { b |= b>>1; b |= b>>2; @@ -111,14 +110,14 @@ inline uint32_t MaskFromTopBits(uint32_t b) noexcept b |= b>>16; return b; } -const uint32_t MonoMask{MaskFromTopBits(MONO)}; -const uint32_t StereoMask{MaskFromTopBits(STEREO)}; -const uint32_t QuadMask{MaskFromTopBits(QUAD)}; -const uint32_t X51Mask{MaskFromTopBits(X5DOT1)}; -const uint32_t X51RearMask{MaskFromTopBits(X5DOT1REAR)}; -const uint32_t X61Mask{MaskFromTopBits(X6DOT1)}; -const uint32_t X71Mask{MaskFromTopBits(X7DOT1)}; -const uint32_t X71WideMask{MaskFromTopBits(X7DOT1_WIDE)}; +constexpr uint32_t MonoMask{MaskFromTopBits(MONO)}; +constexpr uint32_t StereoMask{MaskFromTopBits(STEREO)}; +constexpr uint32_t QuadMask{MaskFromTopBits(QUAD)}; +constexpr uint32_t X51Mask{MaskFromTopBits(X5DOT1)}; +constexpr uint32_t X51RearMask{MaskFromTopBits(X5DOT1REAR)}; +constexpr uint32_t X61Mask{MaskFromTopBits(X6DOT1)}; +constexpr uint32_t X71Mask{MaskFromTopBits(X7DOT1)}; +constexpr uint32_t X71WideMask{MaskFromTopBits(X7DOT1_WIDE)}; #define DEVNAME_HEAD "OpenAL Soft on " diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index 1b935047..b375724b 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -44,10 +44,9 @@ using complex_d = std::complex<double>; #define FIFO_LATENCY (HIL_STEP * (OVERSAMP-1)) /* Define a Hann window, used to filter the HIL input and output. */ -/* Making this constexpr seems to require C++14. */ -std::array<ALdouble,HIL_SIZE> InitHannWindow() +std::array<double,HIL_SIZE> InitHannWindow() { - std::array<ALdouble,HIL_SIZE> ret; + std::array<double,HIL_SIZE> ret; /* Create lookup table of the Hann window for the desired size, i.e. HIL_SIZE */ for(size_t i{0};i < HIL_SIZE>>1;i++) { @@ -57,7 +56,7 @@ std::array<ALdouble,HIL_SIZE> InitHannWindow() } return ret; } -alignas(16) const std::array<ALdouble,HIL_SIZE> HannWindow = InitHannWindow(); +alignas(16) const std::array<double,HIL_SIZE> HannWindow = InitHannWindow(); struct FshifterState final : public EffectState { diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index d7ba072e..7b00a87e 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -50,10 +50,9 @@ using complex_d = std::complex<double>; #define FIFO_LATENCY (STFT_STEP * (OVERSAMP-1)) /* Define a Hann window, used to filter the STFT input and output. */ -/* Making this constexpr seems to require C++14. */ -std::array<ALdouble,STFT_SIZE> InitHannWindow() +std::array<double,STFT_SIZE> InitHannWindow() { - std::array<ALdouble,STFT_SIZE> ret; + std::array<double,STFT_SIZE> ret; /* Create lookup table of the Hann window for the desired size, i.e. HIL_SIZE */ for(size_t i{0};i < STFT_SIZE>>1;i++) { @@ -63,7 +62,7 @@ std::array<ALdouble,STFT_SIZE> InitHannWindow() } return ret; } -alignas(16) const std::array<ALdouble,STFT_SIZE> HannWindow = InitHannWindow(); +alignas(16) const std::array<double,STFT_SIZE> HannWindow = InitHannWindow(); struct ALphasor { diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index a705bdd7..8078bbc3 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -1392,12 +1392,12 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const char *devname, const A ERR("Could not get resource %u, %s\n", residx, name.c_str()); return nullptr; } - stream = al::make_unique<idstream>(res.begin(), res.end()); + stream = std::make_unique<idstream>(res.begin(), res.end()); } else { TRACE("Loading %s...\n", fname.c_str()); - auto fstr = al::make_unique<al::ifstream>(fname.c_str(), std::ios::binary); + auto fstr = std::make_unique<al::ifstream>(fname.c_str(), std::ios::binary); if(!fstr->is_open()) { ERR("Could not open %s\n", fname.c_str()); diff --git a/alc/panning.cpp b/alc/panning.cpp index 1f80be55..0b7b5038 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -831,7 +831,7 @@ no_hrtf: { if(*cflevopt > 0 && *cflevopt <= 6) { - device->Bs2b = al::make_unique<bs2b>(); + device->Bs2b = std::make_unique<bs2b>(); bs2b_set_params(device->Bs2b.get(), *cflevopt, static_cast<int>(device->Frequency)); TRACE("BS2B enabled\n"); @@ -852,7 +852,7 @@ no_hrtf: } if(device->mRenderMode == NormalRender) { - device->Uhj_Encoder = al::make_unique<Uhj2Encoder>(); + device->Uhj_Encoder = std::make_unique<Uhj2Encoder>(); TRACE("UHJ enabled\n"); InitUhjPanning(device); device->PostProcess = &ALCdevice::ProcessUhj; diff --git a/common/almalloc.h b/common/almalloc.h index 1a1e2557..804ea9d8 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -216,14 +216,6 @@ inline T1 uninitialized_move_n(T0 first, N count, const T1 output) } -/* std::make_unique was added with C++14, so until we rely on that, make our - * own version. - */ -template<typename T, typename ...ArgsT> -std::unique_ptr<T> make_unique(ArgsT&&...args) -{ return std::unique_ptr<T>{new T{std::forward<ArgsT>(args)...}}; } - - /* A flexible array type. Used either standalone or at the end of a parent * struct, with placement new, to have a run-time-sized array that's embedded * with its size. |