aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax_utils.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-05-16 02:08:18 -0700
committerChris Robinson <[email protected]>2022-05-16 02:08:18 -0700
commit65e4c20c27f2acf853e58fd4c26ebc0e3eb926c6 (patch)
tree4fb9a3bffbda4ab8dc1363caa2426cf8e8bbf30e /al/eax_utils.h
parent83238973ed08225adf03e76b6933e0c209f93fd9 (diff)
Move EAX files to their own sub-directory
Diffstat (limited to 'al/eax_utils.h')
-rw-r--r--al/eax_utils.h132
1 files changed, 0 insertions, 132 deletions
diff --git a/al/eax_utils.h b/al/eax_utils.h
deleted file mode 100644
index d3d4a196..00000000
--- a/al/eax_utils.h
+++ /dev/null
@@ -1,132 +0,0 @@
-#ifndef EAX_UTILS_INCLUDED
-#define EAX_UTILS_INCLUDED
-
-#include <algorithm>
-#include <cstdint>
-#include <string>
-#include <type_traits>
-
-
-struct EaxAlLowPassParam
-{
- float gain;
- float gain_hf;
-}; // EaxAlLowPassParam
-
-
-void eax_log_exception(
- const char* message = nullptr) noexcept;
-
-
-template<
- typename TException,
- typename TValue
->
-void eax_validate_range(
- const char* value_name,
- const TValue& value,
- const TValue& min_value,
- const TValue& max_value)
-{
- if (value >= min_value && value <= max_value)
- {
- return;
- }
-
- const auto message =
- std::string{value_name} +
- " out of range (value: " +
- std::to_string(value) + "; min: " +
- std::to_string(min_value) + "; max: " +
- std::to_string(max_value) + ").";
-
- throw TException{message.c_str()};
-}
-
-
-namespace detail
-{
-
-
-template<
- typename T
->
-struct EaxIsBitFieldStruct
-{
-private:
- using yes = std::true_type;
- using no = std::false_type;
-
- template<
- typename U
- >
- static auto test(int) -> decltype(std::declval<typename U::EaxIsBitFieldStruct>(), yes{});
-
- template<
- typename
- >
- static no test(...);
-
-
-public:
- static constexpr auto value = std::is_same<decltype(test<T>(0)), yes>::value;
-}; // EaxIsBitFieldStruct
-
-
-template<
- typename T,
- typename TValue
->
-inline bool eax_bit_fields_are_equal(
- const T& lhs,
- const T& rhs) noexcept
-{
- static_assert(sizeof(T) == sizeof(TValue), "Invalid type size.");
-
- return reinterpret_cast<const TValue&>(lhs) == reinterpret_cast<const TValue&>(rhs);
-}
-
-
-} // namespace detail
-
-
-template<
- typename T,
- std::enable_if_t<detail::EaxIsBitFieldStruct<T>::value, int> = 0
->
-inline bool operator==(
- const T& lhs,
- const T& rhs) noexcept
-{
- using Value = std::conditional_t<
- sizeof(T) == 1,
- std::uint8_t,
- std::conditional_t<
- sizeof(T) == 2,
- std::uint16_t,
- std::conditional_t<
- sizeof(T) == 4,
- std::uint32_t,
- void
- >
- >
- >;
-
- static_assert(!std::is_same<Value, void>::value, "Unsupported type.");
-
- return detail::eax_bit_fields_are_equal<T, Value>(lhs, rhs);
-}
-
-template<
- typename T,
- std::enable_if_t<detail::EaxIsBitFieldStruct<T>::value, int> = 0
->
-inline bool operator!=(
- const T& lhs,
- const T& rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-
-#endif // !EAX_UTILS_INCLUDED