From 816bd8ab309dc0fe9afefcc5e3f2c294d3dc60a5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 30 Jan 2022 05:42:44 -0800 Subject: Move ALSOFT_EAX definition to config.h And disable it by default for non-Windows targets --- common/alnumeric.h | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) (limited to 'common/alnumeric.h') diff --git a/common/alnumeric.h b/common/alnumeric.h index d72ba1e3..18df2689 100644 --- a/common/alnumeric.h +++ b/common/alnumeric.h @@ -1,10 +1,8 @@ #ifndef AL_NUMERIC_H #define AL_NUMERIC_H -#if ALSOFT_EAX +#include #include -#endif // ALSOFT_EAX - #include #include #ifdef HAVE_INTRIN_H @@ -275,45 +273,27 @@ inline float fast_roundf(float f) noexcept #endif } -#if ALSOFT_EAX -template< - typename T -> -inline constexpr const T& clamp( - const T& value, - const T& min_value, - const T& max_value) noexcept + +template +constexpr const T& clamp(const T& value, const T& min_value, const T& max_value) noexcept { - return value < min_value ? min_value : (value > max_value ? max_value : value); + return std::min(std::max(value, min_value), max_value); } // Converts level (mB) to gain. -inline float level_mb_to_gain( - float x) +inline float level_mb_to_gain(float x) { - if (x <= -10'000.0F) - { - return 0.0F; - } - else - { - return std::pow(10.0F, x / 2'000.0F); - } + if(x <= -10'000.0f) + return 0.0f; + return std::pow(10.0f, x / 2'000.0f); } // Converts gain to level (mB). -inline float gain_to_level_mb( - float x) +inline float gain_to_level_mb(float x) { - if (x <= 0.0F) - { - return -10'000.0F; - } - else - { - return std::log10(x * 2'000.0F); - } + if (x <= 0.0f) + return -10'000.0f; + return std::log10(x * 2'000.0f); } -#endif // ALSOFT_EAX #endif /* AL_NUMERIC_H */ -- cgit v1.2.3