diff options
author | Sven Gothel <[email protected]> | 2023-11-28 12:51:46 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-11-28 12:51:46 +0100 |
commit | 1aaf4f070011490bcece50394b9b32dfa593fd9e (patch) | |
tree | 17d68284e401a35eea3d3a574d986d446a60763a /al/eax | |
parent | 6e7cee4fa9a8af03f28ca26cd89f8357390dfc90 (diff) | |
parent | 571b546f35eead77ce109f8d4dd6c3de3199d573 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'al/eax')
-rw-r--r-- | al/eax/api.h | 32 | ||||
-rw-r--r-- | al/eax/call.h | 4 | ||||
-rw-r--r-- | al/eax/effect.h | 113 | ||||
-rw-r--r-- | al/eax/exception.cpp | 47 | ||||
-rw-r--r-- | al/eax/exception.h | 6 | ||||
-rw-r--r-- | al/eax/fx_slot_index.h | 7 | ||||
-rw-r--r-- | al/eax/globals.cpp | 21 | ||||
-rw-r--r-- | al/eax/globals.h | 24 | ||||
-rw-r--r-- | al/eax/utils.cpp | 6 | ||||
-rw-r--r-- | al/eax/utils.h | 12 | ||||
-rw-r--r-- | al/eax/x_ram.h | 11 |
11 files changed, 117 insertions, 166 deletions
diff --git a/al/eax/api.h b/al/eax/api.h index d254da1f..18d93ef8 100644 --- a/al/eax/api.h +++ b/al/eax/api.h @@ -10,17 +10,18 @@ // +#include <array> #include <cfloat> #include <cstdint> #include <cstring> - -#include <array> +#ifdef _WIN32 +#include <guiddef.h> +#endif #include "AL/al.h" -#ifndef GUID_DEFINED -#define GUID_DEFINED +#ifndef _WIN32 typedef struct _GUID { std::uint32_t Data1; std::uint16_t Data2; @@ -28,16 +29,16 @@ typedef struct _GUID { std::uint8_t Data4[8]; } GUID; -#ifndef _SYS_GUID_OPERATOR_EQ_ -#define _SYS_GUID_OPERATOR_EQ_ inline bool operator==(const GUID& lhs, const GUID& rhs) noexcept { return std::memcmp(&lhs, &rhs, sizeof(GUID)) == 0; } inline bool operator!=(const GUID& lhs, const GUID& rhs) noexcept { return !(lhs == rhs); } -#endif // _SYS_GUID_OPERATOR_EQ_ -#endif // GUID_DEFINED +#endif // _WIN32 +#define DECL_EQOP(T) \ +friend bool operator==(const T &lhs, const T &rhs) noexcept { return std::memcmp(&lhs, &rhs, sizeof(T)) == 0; } \ +friend bool operator!=(const T &lhs, const T &rhs) noexcept { return !(lhs == rhs); } extern const GUID DSPROPSETID_EAX_ReverbProperties; @@ -613,7 +614,7 @@ struct EAX30SOURCEPROPERTIES { float flOcclusionLFRatio; // occlusion low-frequency level re. main control float flOcclusionRoomRatio; // relative occlusion control for room effect float flOcclusionDirectRatio; // relative occlusion control for direct path - long lExclusion; // main exlusion control (attenuation at high frequencies) + long lExclusion; // main exclusion control (attenuation at high frequencies) float flExclusionLFRatio; // exclusion low-frequency level re. main control long lOutsideVolumeHF; // outside sound cone level at high frequencies float flDopplerFactor; // like DS3D flDopplerFactor but per source @@ -836,6 +837,7 @@ struct EAXREVERBPROPERTIES { float flLFReference; // reference low frequency float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect unsigned long ulFlags; // modifies the behavior of properties + DECL_EQOP(EAXREVERBPROPERTIES) }; // EAXREVERBPROPERTIES @@ -965,6 +967,7 @@ enum EAXAGCCOMPRESSOR_PROPERTY : unsigned int { struct EAXAGCCOMPRESSORPROPERTIES { unsigned long ulOnOff; // Switch Compressor on or off + DECL_EQOP(EAXAGCCOMPRESSORPROPERTIES) }; // EAXAGCCOMPRESSORPROPERTIES @@ -991,6 +994,7 @@ struct EAXAUTOWAHPROPERTIES { float flReleaseTime; // Release time (seconds) long lResonance; // Resonance (mB) long lPeakLevel; // Peak level (mB) + DECL_EQOP(EAXAUTOWAHPROPERTIES) }; // EAXAUTOWAHPROPERTIES @@ -1038,6 +1042,7 @@ struct EAXCHORUSPROPERTIES { float flDepth; // Depth (0 to 1) float flFeedback; // Feedback (-1 to 1) float flDelay; // Delay (seconds) + DECL_EQOP(EAXCHORUSPROPERTIES) }; // EAXCHORUSPROPERTIES @@ -1086,6 +1091,7 @@ struct EAXDISTORTIONPROPERTIES { float flLowPassCutOff; // Controls the cut-off of the filter pre-distortion (Hz) float flEQCenter; // Controls the center frequency of the EQ post-distortion (Hz) float flEQBandwidth; // Controls the bandwidth of the EQ post-distortion (Hz) + DECL_EQOP(EAXDISTORTIONPROPERTIES) }; // EAXDISTORTIONPROPERTIES @@ -1130,6 +1136,7 @@ struct EAXECHOPROPERTIES { float flDamping; // Controls a low-pass filter that dampens the echoes (0 to 1) float flFeedback; // Controls the duration of echo repetition (0 to 1) float flSpread; // Controls the left-right spread of the echoes + DECL_EQOP(EAXECHOPROPERTIES) }; // EAXECHOPROPERTIES @@ -1184,6 +1191,7 @@ struct EAXEQUALIZERPROPERTIES { float flMid2Width; // (octaves) long lHighGain; // (mB) float flHighCutOff; // (Hz) + DECL_EQOP(EAXEQUALIZERPROPERTIES) }; // EAXEQUALIZERPROPERTIES @@ -1255,6 +1263,7 @@ struct EAXFLANGERPROPERTIES { float flDepth; // Depth (0 to 1) float flFeedback; // Feedback (0 to 1) float flDelay; // Delay (seconds) + DECL_EQOP(EAXFLANGERPROPERTIES) }; // EAXFLANGERPROPERTIES @@ -1305,6 +1314,7 @@ struct EAXFREQUENCYSHIFTERPROPERTIES { float flFrequency; // (Hz) unsigned long ulLeftDirection; // see enum above unsigned long ulRightDirection; // see enum above + DECL_EQOP(EAXFREQUENCYSHIFTERPROPERTIES) }; // EAXFREQUENCYSHIFTERPROPERTIES @@ -1383,6 +1393,7 @@ struct EAXVOCALMORPHERPROPERTIES { long lPhonemeBCoarseTuning; // (semitones) unsigned long ulWaveform; // Waveform selector - see enum above float flRate; // (Hz) + DECL_EQOP(EAXVOCALMORPHERPROPERTIES) }; // EAXVOCALMORPHERPROPERTIES @@ -1425,6 +1436,7 @@ enum EAXPITCHSHIFTER_PROPERTY : unsigned int { struct EAXPITCHSHIFTERPROPERTIES { long lCoarseTune; // Amount of pitch shift (semitones) long lFineTune; // Amount of pitch shift (cents) + DECL_EQOP(EAXPITCHSHIFTERPROPERTIES) }; // EAXPITCHSHIFTERPROPERTIES @@ -1460,6 +1472,7 @@ struct EAXRINGMODULATORPROPERTIES { float flFrequency; // Frequency of modulation (Hz) float flHighPassCutOff; // Cut-off frequency of high-pass filter (Hz) unsigned long ulWaveform; // Waveform selector - see enum above + DECL_EQOP(EAXRINGMODULATORPROPERTIES) }; // EAXRINGMODULATORPROPERTIES @@ -1490,4 +1503,5 @@ using LPEAXGET = ALenum(AL_APIENTRY*)( ALvoid* property_buffer, ALuint property_size); +#undef DECL_EQOP #endif // !EAX_API_INCLUDED diff --git a/al/eax/call.h b/al/eax/call.h index 5ec33b0f..45ff328c 100644 --- a/al/eax/call.h +++ b/al/eax/call.h @@ -55,13 +55,13 @@ public: fail_too_small(); const auto count = minz(mPropertyBufferSize / sizeof(TValue), max_count); - return al::as_span(static_cast<TValue*>(mPropertyBuffer), count); + return {static_cast<TValue*>(mPropertyBuffer), count}; } template<typename TValue> al::span<TValue> get_values() const { - return get_values<TValue>(~size_t{}); + return get_values<TValue>(~0_uz); } template<typename TException, typename TValue> diff --git a/al/eax/effect.h b/al/eax/effect.h index a0b4e71b..afe4d94d 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -4,60 +4,55 @@ #include <cassert> #include <memory> +#include <variant> #include "alnumeric.h" #include "AL/al.h" #include "core/effects/base.h" #include "call.h" -struct EaxEffectErrorMessages -{ +struct EaxEffectErrorMessages { static constexpr auto unknown_property_id() noexcept { return "Unknown property id."; } static constexpr auto unknown_version() noexcept { return "Unknown version."; } }; // EaxEffectErrorMessages -/* TODO: Use std::variant (C++17). */ -enum class EaxEffectType { - None, Reverb, Chorus, Autowah, Compressor, Distortion, Echo, Equalizer, Flanger, - FrequencyShifter, Modulator, PitchShifter, VocalMorpher -}; -struct EaxEffectProps { - EaxEffectType mType; - union { - EAXREVERBPROPERTIES mReverb; - EAXCHORUSPROPERTIES mChorus; - EAXAUTOWAHPROPERTIES mAutowah; - EAXAGCCOMPRESSORPROPERTIES mCompressor; - EAXDISTORTIONPROPERTIES mDistortion; - EAXECHOPROPERTIES mEcho; - EAXEQUALIZERPROPERTIES mEqualizer; - EAXFLANGERPROPERTIES mFlanger; - EAXFREQUENCYSHIFTERPROPERTIES mFrequencyShifter; - EAXRINGMODULATORPROPERTIES mModulator; - EAXPITCHSHIFTERPROPERTIES mPitchShifter; - EAXVOCALMORPHERPROPERTIES mVocalMorpher; - }; -}; - -constexpr ALenum EnumFromEaxEffectType(const EaxEffectProps &props) +using EaxEffectProps = std::variant<std::monostate, + EAXREVERBPROPERTIES, + EAXCHORUSPROPERTIES, + EAXAUTOWAHPROPERTIES, + EAXAGCCOMPRESSORPROPERTIES, + EAXDISTORTIONPROPERTIES, + EAXECHOPROPERTIES, + EAXEQUALIZERPROPERTIES, + EAXFLANGERPROPERTIES, + EAXFREQUENCYSHIFTERPROPERTIES, + EAXRINGMODULATORPROPERTIES, + EAXPITCHSHIFTERPROPERTIES, + EAXVOCALMORPHERPROPERTIES>; + +template<typename... Ts> +struct overloaded : Ts... { using Ts::operator()...; }; + +template<typename... Ts> +overloaded(Ts...) -> overloaded<Ts...>; + +constexpr ALenum EnumFromEaxEffectType(const EaxEffectProps &props) noexcept { - switch(props.mType) - { - case EaxEffectType::None: break; - case EaxEffectType::Reverb: return AL_EFFECT_EAXREVERB; - case EaxEffectType::Chorus: return AL_EFFECT_CHORUS; - case EaxEffectType::Autowah: return AL_EFFECT_AUTOWAH; - case EaxEffectType::Compressor: return AL_EFFECT_COMPRESSOR; - case EaxEffectType::Distortion: return AL_EFFECT_DISTORTION; - case EaxEffectType::Echo: return AL_EFFECT_ECHO; - case EaxEffectType::Equalizer: return AL_EFFECT_EQUALIZER; - case EaxEffectType::Flanger: return AL_EFFECT_FLANGER; - case EaxEffectType::FrequencyShifter: return AL_EFFECT_FREQUENCY_SHIFTER; - case EaxEffectType::Modulator: return AL_EFFECT_RING_MODULATOR; - case EaxEffectType::PitchShifter: return AL_EFFECT_PITCH_SHIFTER; - case EaxEffectType::VocalMorpher: return AL_EFFECT_VOCAL_MORPHER; - } - return AL_EFFECT_NULL; + return std::visit(overloaded{ + [](const std::monostate&) noexcept { return AL_EFFECT_NULL; }, + [](const EAXREVERBPROPERTIES&) noexcept { return AL_EFFECT_EAXREVERB; }, + [](const EAXCHORUSPROPERTIES&) noexcept { return AL_EFFECT_CHORUS; }, + [](const EAXAUTOWAHPROPERTIES&) noexcept { return AL_EFFECT_AUTOWAH; }, + [](const EAXAGCCOMPRESSORPROPERTIES&) noexcept { return AL_EFFECT_COMPRESSOR; }, + [](const EAXDISTORTIONPROPERTIES&) noexcept { return AL_EFFECT_DISTORTION; }, + [](const EAXECHOPROPERTIES&) noexcept { return AL_EFFECT_ECHO; }, + [](const EAXEQUALIZERPROPERTIES&) noexcept { return AL_EFFECT_EQUALIZER; }, + [](const EAXFLANGERPROPERTIES&) noexcept { return AL_EFFECT_FLANGER; }, + [](const EAXFREQUENCYSHIFTERPROPERTIES&) noexcept { return AL_EFFECT_FREQUENCY_SHIFTER; }, + [](const EAXRINGMODULATORPROPERTIES&) noexcept { return AL_EFFECT_RING_MODULATOR; }, + [](const EAXPITCHSHIFTERPROPERTIES&) noexcept { return AL_EFFECT_PITCH_SHIFTER; }, + [](const EAXVOCALMORPHERPROPERTIES&) noexcept { return AL_EFFECT_VOCAL_MORPHER; } + }, props); } struct EaxReverbCommitter { @@ -300,30 +295,30 @@ public: } -#define EAXCALL(T, Callable, ...) \ - if(T == EaxEffectType::Reverb) \ +#define EAXCALL(Props, Callable, ...) \ + if(std::holds_alternative<EAXREVERBPROPERTIES>(Props)) \ return Callable<EaxReverbCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Chorus) \ + if(std::holds_alternative<EAXCHORUSPROPERTIES>(Props)) \ return Callable<EaxChorusCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Autowah) \ + if(std::holds_alternative<EAXAUTOWAHPROPERTIES>(Props)) \ return Callable<EaxAutowahCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Compressor) \ + if(std::holds_alternative<EAXAGCCOMPRESSORPROPERTIES>(Props)) \ return Callable<EaxCompressorCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Distortion) \ + if(std::holds_alternative<EAXDISTORTIONPROPERTIES>(Props)) \ return Callable<EaxDistortionCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Echo) \ + if(std::holds_alternative<EAXECHOPROPERTIES>(Props)) \ return Callable<EaxEchoCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Equalizer) \ + if(std::holds_alternative<EAXEQUALIZERPROPERTIES>(Props)) \ return Callable<EaxEqualizerCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Flanger) \ + if(std::holds_alternative<EAXFLANGERPROPERTIES>(Props)) \ return Callable<EaxFlangerCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::FrequencyShifter) \ + if(std::holds_alternative<EAXFREQUENCYSHIFTERPROPERTIES>(Props)) \ return Callable<EaxFrequencyShifterCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::Modulator) \ + if(std::holds_alternative<EAXRINGMODULATORPROPERTIES>(Props)) \ return Callable<EaxModulatorCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::PitchShifter) \ + if(std::holds_alternative<EAXPITCHSHIFTERPROPERTIES>(Props)) \ return Callable<EaxPitchShifterCommitter>(__VA_ARGS__); \ - if(T == EaxEffectType::VocalMorpher) \ + if(std::holds_alternative<EAXVOCALMORPHERPROPERTIES>(Props)) \ return Callable<EaxVocalMorpherCommitter>(__VA_ARGS__); \ return Callable<EaxNullCommitter>(__VA_ARGS__) @@ -332,7 +327,7 @@ public: { return T::Set(std::forward<Args>(args)...); } static void call_set(const EaxCall &call, EaxEffectProps &props) - { EAXCALL(props.mType, call_set, call, props); } + { EAXCALL(props, call_set, call, props); } void set(const EaxCall &call) { @@ -353,7 +348,7 @@ public: { return T::Get(std::forward<Args>(args)...); } static void call_get(const EaxCall &call, const EaxEffectProps &props) - { EAXCALL(props.mType, call_get, call, props); } + { EAXCALL(props, call_get, call, props); } void get(const EaxCall &call) { @@ -373,7 +368,7 @@ public: { return T{props_, al_effect_props_}.commit(std::forward<Args>(args)...); } bool call_commit(const EaxEffectProps &props) - { EAXCALL(props.mType, call_commit, props); } + { EAXCALL(props, call_commit, props); } bool commit(int eax_version) { diff --git a/al/eax/exception.cpp b/al/eax/exception.cpp index 435e7442..e4945d88 100644 --- a/al/eax/exception.cpp +++ b/al/eax/exception.cpp @@ -6,54 +6,27 @@ #include <string> -EaxException::EaxException(const char *context, const char *message) +EaxException::EaxException(std::string_view context, std::string_view message) : std::runtime_error{make_message(context, message)} { } EaxException::~EaxException() = default; -std::string EaxException::make_message(const char *context, const char *message) +std::string EaxException::make_message(std::string_view context, std::string_view message) { - const auto context_size = (context ? std::string::traits_type::length(context) : 0); - const auto has_contex = (context_size > 0); - - const auto message_size = (message ? std::string::traits_type::length(message) : 0); - const auto has_message = (message_size > 0); - - if (!has_contex && !has_message) - { - return std::string{}; - } - - static constexpr char left_prefix[] = "["; - const auto left_prefix_size = std::string::traits_type::length(left_prefix); - - static constexpr char right_prefix[] = "] "; - const auto right_prefix_size = std::string::traits_type::length(right_prefix); - - const auto what_size = - ( - has_contex ? - left_prefix_size + context_size + right_prefix_size : - 0) + - message_size + - 1; - auto what = std::string{}; - what.reserve(what_size); - - if (has_contex) - { - what.append(left_prefix, left_prefix_size); - what.append(context, context_size); - what.append(right_prefix, right_prefix_size); - } + if(context.empty() && message.empty()) + return what; - if (has_message) + what.reserve((!context.empty() ? context.size() + 3 : 0) + message.length() + 1); + if(!context.empty()) { - what.append(message, message_size); + what += "["; + what += context; + what += "] "; } + what += message; return what; } diff --git a/al/eax/exception.h b/al/eax/exception.h index 3ae88cdc..336654f0 100644 --- a/al/eax/exception.h +++ b/al/eax/exception.h @@ -1,16 +1,16 @@ #ifndef EAX_EXCEPTION_INCLUDED #define EAX_EXCEPTION_INCLUDED - #include <stdexcept> #include <string> +#include <string_view> class EaxException : public std::runtime_error { - static std::string make_message(const char *context, const char *message); + static std::string make_message(std::string_view context, std::string_view message); public: - EaxException(const char *context, const char *message); + EaxException(std::string_view context, std::string_view message); ~EaxException() override; }; // EaxException diff --git a/al/eax/fx_slot_index.h b/al/eax/fx_slot_index.h index 63dba037..9f350d9b 100644 --- a/al/eax/fx_slot_index.h +++ b/al/eax/fx_slot_index.h @@ -3,17 +3,16 @@ #include <cstddef> +#include <optional> -#include "aloptional.h" #include "api.h" using EaxFxSlotIndexValue = std::size_t; -class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue> -{ +class EaxFxSlotIndex : public std::optional<EaxFxSlotIndexValue> { public: - using al::optional<EaxFxSlotIndexValue>::optional; + using std::optional<EaxFxSlotIndexValue>::optional; EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; } EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; } diff --git a/al/eax/globals.cpp b/al/eax/globals.cpp deleted file mode 100644 index 80e9dbfe..00000000 --- a/al/eax/globals.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "config.h" - -#include "globals.h" - - -bool eax_g_is_enabled = true; - - -const char eax1_ext_name[] = "EAX"; -const char eax2_ext_name[] = "EAX2.0"; -const char eax3_ext_name[] = "EAX3.0"; -const char eax4_ext_name[] = "EAX4.0"; -const char eax5_ext_name[] = "EAX5.0"; - -const char eax_x_ram_ext_name[] = "EAX-RAM"; - -const char eax_eax_set_func_name[] = "EAXSet"; -const char eax_eax_get_func_name[] = "EAXGet"; - -const char eax_eax_set_buffer_mode_func_name[] = "EAXSetBufferMode"; -const char eax_eax_get_buffer_mode_func_name[] = "EAXGetBufferMode"; diff --git a/al/eax/globals.h b/al/eax/globals.h index 1b4d63b8..ff05d009 100644 --- a/al/eax/globals.h +++ b/al/eax/globals.h @@ -1,22 +1,20 @@ #ifndef EAX_GLOBALS_INCLUDED #define EAX_GLOBALS_INCLUDED +inline bool eax_g_is_enabled{true}; -extern bool eax_g_is_enabled; +inline constexpr char eax1_ext_name[]{"EAX"}; +inline constexpr char eax2_ext_name[]{"EAX2.0"}; +inline constexpr char eax3_ext_name[]{"EAX3.0"}; +inline constexpr char eax4_ext_name[]{"EAX4.0"}; +inline constexpr char eax5_ext_name[]{"EAX5.0"}; +inline constexpr char eax_x_ram_ext_name[]{"EAX-RAM"}; -extern const char eax1_ext_name[]; -extern const char eax2_ext_name[]; -extern const char eax3_ext_name[]; -extern const char eax4_ext_name[]; -extern const char eax5_ext_name[]; +inline constexpr char eax_eax_set_func_name[]{"EAXSet"}; +inline constexpr char eax_eax_get_func_name[]{"EAXGet"}; -extern const char eax_x_ram_ext_name[]; - -extern const char eax_eax_set_func_name[]; -extern const char eax_eax_get_func_name[]; - -extern const char eax_eax_set_buffer_mode_func_name[]; -extern const char eax_eax_get_buffer_mode_func_name[]; +inline constexpr char eax_eax_set_buffer_mode_func_name[]{"EAXSetBufferMode"}; +inline constexpr char eax_eax_get_buffer_mode_func_name[]{"EAXGetBufferMode"}; #endif // !EAX_GLOBALS_INCLUDED diff --git a/al/eax/utils.cpp b/al/eax/utils.cpp index b3ed6ca1..53599ac5 100644 --- a/al/eax/utils.cpp +++ b/al/eax/utils.cpp @@ -8,7 +8,7 @@ #include "core/logging.h" -void eax_log_exception(const char *message) noexcept +void eax_log_exception(std::string_view message) noexcept { const auto exception_ptr = std::current_exception(); assert(exception_ptr); @@ -18,9 +18,9 @@ void eax_log_exception(const char *message) noexcept } catch(const std::exception& ex) { const auto ex_message = ex.what(); - ERR("%s %s\n", message ? message : "", ex_message); + ERR("%.*s %s\n", static_cast<int>(message.length()), message.data(), ex_message); } catch(...) { - ERR("%s %s\n", message ? message : "", "Generic exception."); + ERR("%.*s %s\n", static_cast<int>(message.length()), message.data(), "Generic exception."); } } diff --git a/al/eax/utils.h b/al/eax/utils.h index 8ff75a18..8e0f975f 100644 --- a/al/eax/utils.h +++ b/al/eax/utils.h @@ -4,8 +4,11 @@ #include <algorithm> #include <cstdint> #include <string> +#include <string_view> #include <type_traits> +#include "opthelpers.h" + using EaxDirtyFlags = unsigned int; struct EaxAlLowPassParam { @@ -13,16 +16,13 @@ struct EaxAlLowPassParam { float gain_hf; }; -void eax_log_exception(const char *message) noexcept; +void eax_log_exception(std::string_view message) noexcept; template<typename TException, typename TValue> -void eax_validate_range( - const char* value_name, - const TValue& value, - const TValue& min_value, +void eax_validate_range(std::string_view value_name, const TValue& value, const TValue& min_value, const TValue& max_value) { - if (value >= min_value && value <= max_value) + if(value >= min_value && value <= max_value) LIKELY return; const auto message = diff --git a/al/eax/x_ram.h b/al/eax/x_ram.h index 438b9916..d10fe697 100644 --- a/al/eax/x_ram.h +++ b/al/eax/x_ram.h @@ -25,14 +25,7 @@ constexpr auto AL_STORAGE_HARDWARE_NAME = "AL_STORAGE_HARDWARE"; constexpr auto AL_STORAGE_ACCESSIBLE_NAME = "AL_STORAGE_ACCESSIBLE"; -ALboolean AL_APIENTRY EAXSetBufferMode( - ALsizei n, - const ALuint* buffers, - ALint value); - -ALenum AL_APIENTRY EAXGetBufferMode( - ALuint buffer, - ALint* pReserved); - +ALboolean AL_APIENTRY EAXSetBufferMode(ALsizei n, const ALuint *buffers, ALint value) noexcept; +ALenum AL_APIENTRY EAXGetBufferMode(ALuint buffer, ALint *pReserved) noexcept; #endif // !EAX_X_RAM_INCLUDED |