diff options
author | Chris Robinson <[email protected]> | 2023-05-04 18:42:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-04 18:42:27 -0700 |
commit | c14ca5f3aa6da354440a60656062f6bc68d6fca6 (patch) | |
tree | 46151a136338288ecc6e19b09e5a6f7a7b4ab017 | |
parent | 95b0c59adef778b30dfbe68af70b92d55801fd89 (diff) |
Remove custom stuff for standard
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 2 | ||||
-rw-r--r-- | alc/backends/pipewire.cpp | 4 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 4 | ||||
-rw-r--r-- | alc/panning.cpp | 10 | ||||
-rw-r--r-- | common/alcomplex.cpp | 2 | ||||
-rw-r--r-- | common/alnumbers.h | 16 | ||||
-rw-r--r-- | common/alspan.h | 69 | ||||
-rw-r--r-- | core/ambdec.cpp | 2 | ||||
-rw-r--r-- | core/voice.cpp | 2 |
10 files changed, 44 insertions, 69 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index d226b39d..290cc3d1 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1093,7 +1093,7 @@ void alc_initconfig(void) ALSOFT_GIT_BRANCH); { std::string names; - if(al::size(BackendList) < 1) + if(std::size(BackendList) < 1) names = "(none)"; else { diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index dbc2b038..7e1e8fc7 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -587,7 +587,7 @@ void JackPlayback::start() throw al::backend_exception{al::backend_error::DeviceError, "No playback ports found"}; } - for(size_t i{0};i < al::size(mPort) && mPort[i];++i) + for(size_t i{0};i < std::size(mPort) && mPort[i];++i) { if(!pnames[i]) { diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 9fccf58d..dc52a44d 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -800,7 +800,7 @@ void DeviceNode::parseChannelCount(const spa_pod *value) noexcept constexpr char MonitorPrefix[]{"Monitor of "}; -constexpr auto MonitorPrefixLen = al::size(MonitorPrefix) - 1; +constexpr auto MonitorPrefixLen = std::size(MonitorPrefix) - 1; constexpr char AudioSinkClass[]{"Audio/Sink"}; constexpr char AudioSourceClass[]{"Audio/Source"}; constexpr char AudioSourceVirtualClass[]{"Audio/Source/Virtual"}; @@ -837,7 +837,7 @@ struct NodeProxy { * format, which is what we're interested in). */ uint32_t fmtids[]{SPA_PARAM_EnumFormat}; - ppw_node_subscribe_params(mNode.get(), al::data(fmtids), al::size(fmtids)); + ppw_node_subscribe_params(mNode.get(), std::data(fmtids), std::size(fmtids)); } ~NodeProxy() { spa_hook_remove(&mListener); } diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 16576733..97f0a291 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -125,7 +125,7 @@ constexpr DWORD X71Mask{MaskFromTopBits(X7DOT1)}; constexpr DWORD X714Mask{MaskFromTopBits(X7DOT1DOT4)}; constexpr char DevNameHead[] = "OpenAL Soft on "; -constexpr size_t DevNameHeadLen{al::size(DevNameHead) - 1}; +constexpr size_t DevNameHeadLen{std::size(DevNameHead) - 1}; /* Scales the given reftime value, rounding the result. */ @@ -142,7 +142,7 @@ class GuidPrinter { public: GuidPrinter(const GUID &guid) { - std::snprintf(mMsg, al::size(mMsg), "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + std::snprintf(mMsg, std::size(mMsg), "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", DWORD{guid.Data1}, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); } diff --git a/alc/panning.cpp b/alc/panning.cpp index a3d639fc..60ce7ca4 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -346,10 +346,10 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf, } std::copy_n(std::begin(conf->HFOrderGain), - std::min(al::size(conf->HFOrderGain), al::size(decoder.mOrderGain)), + std::min(std::size(conf->HFOrderGain), std::size(decoder.mOrderGain)), std::begin(decoder.mOrderGain)); std::copy_n(std::begin(conf->LFOrderGain), - std::min(al::size(conf->LFOrderGain), al::size(decoder.mOrderGainLF)), + std::min(std::size(conf->LFOrderGain), std::size(decoder.mOrderGainLF)), std::begin(decoder.mOrderGainLF)); const auto num_coeffs = decoder.mIs3D ? AmbiChannelsFromOrder(decoder.mOrder) @@ -818,9 +818,9 @@ void InitHrtfPanning(ALCdevice *device) /*RMS 8.340921354e-01f, 7.182670250e-01f, 5.107426573e-01f, 2.541870634e-01f*/ }; - static_assert(al::size(AmbiPoints1O) == al::size(AmbiMatrix1O), "First-Order Ambisonic HRTF mismatch"); - static_assert(al::size(AmbiPoints2O) == al::size(AmbiMatrix2O), "Second-Order Ambisonic HRTF mismatch"); - static_assert(al::size(AmbiPoints3O) == al::size(AmbiMatrix3O), "Third-Order Ambisonic HRTF mismatch"); + static_assert(std::size(AmbiPoints1O) == std::size(AmbiMatrix1O), "First-Order Ambisonic HRTF mismatch"); + static_assert(std::size(AmbiPoints2O) == std::size(AmbiMatrix2O), "Second-Order Ambisonic HRTF mismatch"); + static_assert(std::size(AmbiPoints3O) == std::size(AmbiMatrix3O), "Third-Order Ambisonic HRTF mismatch"); /* A 700hz crossover frequency provides tighter sound imaging at the sweet * spot with ambisonic decoding, as the distance between the ears is closer diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp index 4420a1bb..a1ca822d 100644 --- a/common/alcomplex.cpp +++ b/common/alcomplex.cpp @@ -58,7 +58,7 @@ struct BitReverser { ++ret_i; } } - assert(ret_i == al::size(mData)); + assert(ret_i == std::size(mData)); } }; diff --git a/common/alnumbers.h b/common/alnumbers.h index 37a55410..800b1f2a 100644 --- a/common/alnumbers.h +++ b/common/alnumbers.h @@ -13,21 +13,21 @@ namespace detail_ { } // detail_ template<typename T> -static constexpr auto pi_v = detail_::as_fp<T>(3.141592653589793238462643383279502884L); +constexpr auto pi_v = detail_::as_fp<T>(3.141592653589793238462643383279502884L); template<typename T> -static constexpr auto inv_pi_v = detail_::as_fp<T>(0.318309886183790671537767526745028724L); +constexpr auto inv_pi_v = detail_::as_fp<T>(0.318309886183790671537767526745028724L); template<typename T> -static constexpr auto sqrt2_v = detail_::as_fp<T>(1.414213562373095048801688724209698079L); +constexpr auto sqrt2_v = detail_::as_fp<T>(1.414213562373095048801688724209698079L); template<typename T> -static constexpr auto sqrt3_v = detail_::as_fp<T>(1.732050807568877293527446341505872367L); +constexpr auto sqrt3_v = detail_::as_fp<T>(1.732050807568877293527446341505872367L); -static constexpr auto pi = pi_v<double>; -static constexpr auto inv_pi = inv_pi_v<double>; -static constexpr auto sqrt2 = sqrt2_v<double>; -static constexpr auto sqrt3 = sqrt3_v<double>; +constexpr auto pi = pi_v<double>; +constexpr auto inv_pi = inv_pi_v<double>; +constexpr auto sqrt2 = sqrt2_v<double>; +constexpr auto sqrt3 = sqrt3_v<double>; } // namespace numbers diff --git a/common/alspan.h b/common/alspan.h index 1d6cdfe5..42b3e057 100644 --- a/common/alspan.h +++ b/common/alspan.h @@ -12,41 +12,12 @@ namespace al { -template<typename T> -constexpr auto size(const T &cont) noexcept(noexcept(cont.size())) -> decltype(cont.size()) -{ return cont.size(); } - -template<typename T, size_t N> -constexpr size_t size(const T (&)[N]) noexcept -{ return N; } - - -template<typename T> -constexpr auto data(T &cont) noexcept(noexcept(cont.data())) -> decltype(cont.data()) -{ return cont.data(); } - -template<typename T> -constexpr auto data(const T &cont) noexcept(noexcept(cont.data())) -> decltype(cont.data()) -{ return cont.data(); } - -template<typename T, size_t N> -constexpr T* data(T (&arr)[N]) noexcept -{ return arr; } - -template<typename T> -constexpr const T* data(std::initializer_list<T> list) noexcept -{ return list.begin(); } - - constexpr size_t dynamic_extent{static_cast<size_t>(-1)}; template<typename T, size_t E=dynamic_extent> class span; namespace detail_ { - template<typename... Ts> - using void_t = void; - template<typename T> struct is_span_ : std::false_type { }; template<typename T, size_t E> @@ -65,7 +36,7 @@ namespace detail_ { constexpr bool has_size_and_data = false; template<typename T> constexpr bool has_size_and_data<T, - void_t<decltype(al::size(std::declval<T>())), decltype(al::data(std::declval<T>()))>> + std::void_t<decltype(std::size(std::declval<T>())),decltype(std::data(std::declval<T>()))>> = true; template<typename T, typename U> @@ -74,7 +45,7 @@ namespace detail_ { template<typename C, typename T> constexpr bool is_valid_container = !is_span_v<C> && !is_std_array_v<C> && !std::is_array<C>::value && has_size_and_data<C> - && is_array_compatible<std::remove_pointer_t<decltype(al::data(std::declval<C&>()))>,T>; + && is_array_compatible<std::remove_pointer_t<decltype(std::data(std::declval<C&>()))>,T>; } // namespace detail_ #define REQUIRES(...) std::enable_if_t<(__VA_ARGS__),bool> = true @@ -107,25 +78,27 @@ public: constexpr explicit span(U first, V) : mData{to_address(first)} { } constexpr span(type_identity_t<element_type> (&arr)[E]) noexcept - : span{al::data(arr), al::size(arr)} + : span{std::data(arr), std::size(arr)} + { } + constexpr span(std::array<value_type,E> &arr) noexcept + : span{std::data(arr), std::size(arr)} { } - constexpr span(std::array<value_type,E> &arr) noexcept : span{al::data(arr), al::size(arr)} { } template<typename U=T, REQUIRES(std::is_const<U>::value)> constexpr span(const std::array<value_type,E> &arr) noexcept - : span{al::data(arr), al::size(arr)} + : span{std::data(arr), std::size(arr)} { } template<typename U, REQUIRES(detail_::is_valid_container<U, element_type>)> - constexpr explicit span(U&& cont) : span{al::data(cont), al::size(cont)} { } + constexpr explicit span(U&& cont) : span{std::data(cont), std::size(cont)} { } template<typename U, index_type N, REQUIRES(!std::is_same<element_type,U>::value && detail_::is_array_compatible<U,element_type> && N == dynamic_extent)> constexpr explicit span(const span<U,N> &span_) noexcept - : span{al::data(span_), al::size(span_)} + : span{std::data(span_), std::size(span_)} { } template<typename U, index_type N, REQUIRES(!std::is_same<element_type,U>::value && detail_::is_array_compatible<U,element_type> && N == extent)> - constexpr span(const span<U,N> &span_) noexcept : span{al::data(span_), al::size(span_)} { } + constexpr span(const span<U,N> &span_) noexcept : span{std::data(span_), std::size(span_)} { } constexpr span(const span&) noexcept = default; constexpr span& operator=(const span &rhs) noexcept = default; @@ -224,21 +197,23 @@ public: template<size_t N> constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept - : span{al::data(arr), al::size(arr)} + : span{std::data(arr), std::size(arr)} { } template<size_t N> - constexpr span(std::array<value_type,N> &arr) noexcept : span{al::data(arr), al::size(arr)} { } + constexpr span(std::array<value_type,N> &arr) noexcept + : span{std::data(arr), std::size(arr)} + { } template<size_t N, typename U=T, REQUIRES(std::is_const<U>::value)> constexpr span(const std::array<value_type,N> &arr) noexcept - : span{al::data(arr), al::size(arr)} + : span{std::data(arr), std::size(arr)} { } template<typename U, REQUIRES(detail_::is_valid_container<U, element_type>)> - constexpr span(U&& cont) : span{al::data(cont), al::size(cont)} { } + constexpr span(U&& cont) : span{std::data(cont), std::size(cont)} { } template<typename U, size_t N, REQUIRES((!std::is_same<element_type,U>::value || extent != N) && detail_::is_array_compatible<U,element_type>)> - constexpr span(const span<U,N> &span_) noexcept : span{al::data(span_), al::size(span_)} { } + constexpr span(const span<U,N> &span_) noexcept : span{std::data(span_), std::size(span_)} { } constexpr span(const span&) noexcept = default; constexpr span& operator=(const span &rhs) noexcept = default; @@ -330,19 +305,19 @@ constexpr auto as_span(T ptr, U count_or_end) return span<value_type>{ptr, count_or_end}; } template<typename T, size_t N> -constexpr auto as_span(T (&arr)[N]) noexcept { return span<T,N>{al::data(arr), al::size(arr)}; } +constexpr auto as_span(T (&arr)[N]) noexcept { return span<T,N>{std::data(arr), std::size(arr)}; } template<typename T, size_t N> constexpr auto as_span(std::array<T,N> &arr) noexcept -{ return span<T,N>{al::data(arr), al::size(arr)}; } +{ return span<T,N>{std::data(arr), std::size(arr)}; } template<typename T, size_t N> constexpr auto as_span(const std::array<T,N> &arr) noexcept -{ return span<std::add_const_t<T>,N>{al::data(arr), al::size(arr)}; } +{ return span<std::add_const_t<T>,N>{std::data(arr), std::size(arr)}; } template<typename U, REQUIRES(!detail_::is_span_v<U> && !detail_::is_std_array_v<U> && !std::is_array<U>::value && detail_::has_size_and_data<U>)> constexpr auto as_span(U&& cont) { - using value_type = std::remove_pointer_t<decltype(al::data(std::declval<U&>()))>; - return span<value_type>{al::data(cont), al::size(cont)}; + using value_type = std::remove_pointer_t<decltype(std::data(std::declval<U&>()))>; + return span<value_type>{std::data(cont), std::size(cont)}; } template<typename T, size_t N> constexpr auto as_span(span<T,N> span_) noexcept { return span_; } diff --git a/core/ambdec.cpp b/core/ambdec.cpp index a056e63f..f98e1098 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -139,7 +139,7 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept { --toread; istr >> value; - if(curgain < al::size(gains)) + if(curgain < std::size(gains)) gains[curgain++] = value; } } diff --git a/core/voice.cpp b/core/voice.cpp index cbf84c2a..db6b6d27 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -288,7 +288,7 @@ inline void LoadSamples<FmtIMA4>(float *RESTRICT dstSamples, const std::byte *sr /* NOTE: This could probably be optimized better. */ size_t wrote{0}; do { - static constexpr int MaxStepIndex{static_cast<int>(al::size(IMAStep_size)) - 1}; + static constexpr int MaxStepIndex{static_cast<int>(std::size(IMAStep_size)) - 1}; /* Each IMA4 block starts with a signed 16-bit sample, and a signed * 16-bit table index. The table index needs to be clamped. */ |