aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax
diff options
context:
space:
mode:
Diffstat (limited to 'al/eax')
-rw-r--r--al/eax/api.h11
-rw-r--r--al/eax/call.cpp3
-rw-r--r--al/eax/call.h28
-rw-r--r--al/eax/effect.h243
-rw-r--r--al/eax/fx_slots.h9
-rw-r--r--al/eax/globals.h2
6 files changed, 169 insertions, 127 deletions
diff --git a/al/eax/api.h b/al/eax/api.h
index 18d93ef8..0b019f11 100644
--- a/al/eax/api.h
+++ b/al/eax/api.h
@@ -22,12 +22,12 @@
#ifndef _WIN32
-typedef struct _GUID {
+using GUID = struct _GUID {
std::uint32_t Data1;
std::uint16_t Data2;
std::uint16_t Data3;
- std::uint8_t Data4[8];
-} GUID;
+ std::array<std::uint8_t,8> Data4;
+};
inline bool operator==(const GUID& lhs, const GUID& rhs) noexcept
{ return std::memcmp(&lhs, &rhs, sizeof(GUID)) == 0; }
@@ -362,6 +362,7 @@ constexpr auto EAXCONTEXT_MINMACROFXFACTOR = 0.0F;
constexpr auto EAXCONTEXT_MAXMACROFXFACTOR = 1.0F;
constexpr auto EAXCONTEXT_DEFAULTMACROFXFACTOR = 0.0F;
+constexpr auto EAXCONTEXT_DEFAULTLASTERROR = EAX_OK;
extern const GUID EAXPROPERTYID_EAX40_FXSlot0;
extern const GUID EAXPROPERTYID_EAX50_FXSlot0;
@@ -654,11 +655,11 @@ struct EAXSPEAKERLEVELPROPERTIES {
}; // EAXSPEAKERLEVELPROPERTIES
struct EAX40ACTIVEFXSLOTS {
- GUID guidActiveFXSlots[EAX40_MAX_ACTIVE_FXSLOTS];
+ std::array<GUID,EAX40_MAX_ACTIVE_FXSLOTS> guidActiveFXSlots;
}; // EAX40ACTIVEFXSLOTS
struct EAX50ACTIVEFXSLOTS {
- GUID guidActiveFXSlots[EAX50_MAX_ACTIVE_FXSLOTS];
+ std::array<GUID,EAX50_MAX_ACTIVE_FXSLOTS> guidActiveFXSlots;
}; // EAX50ACTIVEFXSLOTS
// Use this structure for EAXSOURCE_OBSTRUCTIONPARAMETERS property.
diff --git a/al/eax/call.cpp b/al/eax/call.cpp
index 689d5cf1..013a3992 100644
--- a/al/eax/call.cpp
+++ b/al/eax/call.cpp
@@ -22,8 +22,7 @@ EaxCall::EaxCall(
ALuint property_source_id,
ALvoid* property_buffer,
ALuint property_size)
- : mCallType{type}, mVersion{0}, mPropertySetId{EaxCallPropertySetId::none}
- , mIsDeferred{(property_id & deferred_flag) != 0}
+ : mCallType{type}, mIsDeferred{(property_id & deferred_flag) != 0}
, mPropertyId{property_id & ~deferred_flag}, mPropertySourceId{property_source_id}
, mPropertyBuffer{property_buffer}, mPropertyBufferSize{property_size}
{
diff --git a/al/eax/call.h b/al/eax/call.h
index 45ff328c..e7f2329f 100644
--- a/al/eax/call.h
+++ b/al/eax/call.h
@@ -31,16 +31,16 @@ public:
ALvoid* property_buffer,
ALuint property_size);
- bool is_get() const noexcept { return mCallType == EaxCallType::get; }
- bool is_deferred() const noexcept { return mIsDeferred; }
- int get_version() const noexcept { return mVersion; }
- EaxCallPropertySetId get_property_set_id() const noexcept { return mPropertySetId; }
- ALuint get_property_id() const noexcept { return mPropertyId; }
- ALuint get_property_al_name() const noexcept { return mPropertySourceId; }
- EaxFxSlotIndex get_fx_slot_index() const noexcept { return mFxSlotIndex; }
+ [[nodiscard]] auto is_get() const noexcept -> bool { return mCallType == EaxCallType::get; }
+ [[nodiscard]] auto is_deferred() const noexcept -> bool { return mIsDeferred; }
+ [[nodiscard]] auto get_version() const noexcept -> int { return mVersion; }
+ [[nodiscard]] auto get_property_set_id() const noexcept -> EaxCallPropertySetId { return mPropertySetId; }
+ [[nodiscard]] auto get_property_id() const noexcept -> ALuint { return mPropertyId; }
+ [[nodiscard]] auto get_property_al_name() const noexcept -> ALuint { return mPropertySourceId; }
+ [[nodiscard]] auto get_fx_slot_index() const noexcept -> EaxFxSlotIndex { return mFxSlotIndex; }
template<typename TException, typename TValue>
- TValue& get_value() const
+ [[nodiscard]] auto get_value() const -> TValue&
{
if(mPropertyBufferSize < sizeof(TValue))
fail_too_small();
@@ -49,7 +49,7 @@ public:
}
template<typename TValue>
- al::span<TValue> get_values(size_t max_count) const
+ [[nodiscard]] auto get_values(size_t max_count) const -> al::span<TValue>
{
if(max_count == 0 || mPropertyBufferSize < sizeof(TValue))
fail_too_small();
@@ -59,22 +59,22 @@ public:
}
template<typename TValue>
- al::span<TValue> get_values() const
+ [[nodiscard]] auto get_values() const -> al::span<TValue>
{
return get_values<TValue>(~0_uz);
}
template<typename TException, typename TValue>
- void set_value(const TValue& value) const
+ auto set_value(const TValue& value) const -> void
{
get_value<TException, TValue>() = value;
}
private:
const EaxCallType mCallType;
- int mVersion;
- EaxFxSlotIndex mFxSlotIndex;
- EaxCallPropertySetId mPropertySetId;
+ int mVersion{};
+ EaxFxSlotIndex mFxSlotIndex{};
+ EaxCallPropertySetId mPropertySetId{EaxCallPropertySetId::none};
bool mIsDeferred;
const ALuint mPropertyId;
diff --git a/al/eax/effect.h b/al/eax/effect.h
index afe4d94d..a735fe6c 100644
--- a/al/eax/effect.h
+++ b/al/eax/effect.h
@@ -100,7 +100,6 @@ struct EaxReverbCommitter {
bool commit(const EAX_REVERBPROPERTIES &props);
bool commit(const EAX20LISTENERPROPERTIES &props);
bool commit(const EAXREVERBPROPERTIES &props);
- bool commit(const EaxEffectProps &props);
static void SetDefaults(EAX_REVERBPROPERTIES &props);
static void SetDefaults(EAX20LISTENERPROPERTIES &props);
@@ -110,16 +109,13 @@ struct EaxReverbCommitter {
static void Get(const EaxCall &call, const EAX_REVERBPROPERTIES &props);
static void Get(const EaxCall &call, const EAX20LISTENERPROPERTIES &props);
static void Get(const EaxCall &call, const EAXREVERBPROPERTIES &props);
- static void Get(const EaxCall &call, const EaxEffectProps &props);
static void Set(const EaxCall &call, EAX_REVERBPROPERTIES &props);
static void Set(const EaxCall &call, EAX20LISTENERPROPERTIES &props);
static void Set(const EaxCall &call, EAXREVERBPROPERTIES &props);
- static void Set(const EaxCall &call, EaxEffectProps &props);
- static void translate(const EAX_REVERBPROPERTIES& src, EaxEffectProps& dst) noexcept;
- static void translate(const EAX20LISTENERPROPERTIES& src, EaxEffectProps& dst) noexcept;
- static void translate(const EAXREVERBPROPERTIES& src, EaxEffectProps& dst) noexcept;
+ static void translate(const EAX_REVERBPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept;
+ static void translate(const EAX20LISTENERPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept;
};
template<typename T>
@@ -144,51 +140,137 @@ struct EaxCommitter {
[[noreturn]] static void fail(const char *message);
[[noreturn]] static void fail_unknown_property_id()
{ fail(EaxEffectErrorMessages::unknown_property_id()); }
-
- bool commit(const EaxEffectProps &props);
-
- static void SetDefaults(EaxEffectProps &props);
- static void Get(const EaxCall &call, const EaxEffectProps &props);
- static void Set(const EaxCall &call, EaxEffectProps &props);
};
struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> {
using EaxCommitter<EaxAutowahCommitter>::EaxCommitter;
+
+ bool commit(const EAXAUTOWAHPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXAUTOWAHPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXAUTOWAHPROPERTIES &props);
};
struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> {
using EaxCommitter<EaxChorusCommitter>::EaxCommitter;
+
+ bool commit(const EAXCHORUSPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXCHORUSPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXCHORUSPROPERTIES &props);
};
struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> {
using EaxCommitter<EaxCompressorCommitter>::EaxCommitter;
+
+ bool commit(const EAXAGCCOMPRESSORPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXAGCCOMPRESSORPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXAGCCOMPRESSORPROPERTIES &props);
};
struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> {
using EaxCommitter<EaxDistortionCommitter>::EaxCommitter;
+
+ bool commit(const EAXDISTORTIONPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXDISTORTIONPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXDISTORTIONPROPERTIES &props);
};
struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> {
using EaxCommitter<EaxEchoCommitter>::EaxCommitter;
+
+ bool commit(const EAXECHOPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXECHOPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXECHOPROPERTIES &props);
};
struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> {
using EaxCommitter<EaxEqualizerCommitter>::EaxCommitter;
+
+ bool commit(const EAXEQUALIZERPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXEQUALIZERPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXEQUALIZERPROPERTIES &props);
};
struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> {
using EaxCommitter<EaxFlangerCommitter>::EaxCommitter;
+
+ bool commit(const EAXFLANGERPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXFLANGERPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXFLANGERPROPERTIES &props);
};
struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCommitter> {
using EaxCommitter<EaxFrequencyShifterCommitter>::EaxCommitter;
+
+ bool commit(const EAXFREQUENCYSHIFTERPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXFREQUENCYSHIFTERPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXFREQUENCYSHIFTERPROPERTIES &props);
};
struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> {
using EaxCommitter<EaxModulatorCommitter>::EaxCommitter;
+
+ bool commit(const EAXRINGMODULATORPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXRINGMODULATORPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXRINGMODULATORPROPERTIES &props);
};
struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter> {
using EaxCommitter<EaxPitchShifterCommitter>::EaxCommitter;
+
+ bool commit(const EAXPITCHSHIFTERPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXPITCHSHIFTERPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXPITCHSHIFTERPROPERTIES &props);
};
struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter> {
using EaxCommitter<EaxVocalMorpherCommitter>::EaxCommitter;
+
+ bool commit(const EAXVOCALMORPHERPROPERTIES &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const EAXVOCALMORPHERPROPERTIES &props);
+ static void Set(const EaxCall &call, EAXVOCALMORPHERPROPERTIES &props);
};
struct EaxNullCommitter : public EaxCommitter<EaxNullCommitter> {
using EaxCommitter<EaxNullCommitter>::EaxCommitter;
+
+ bool commit(const std::monostate &props);
+
+ static void SetDefaults(EaxEffectProps &props);
+ static void Get(const EaxCall &call, const std::monostate &props);
+ static void Set(const EaxCall &call, std::monostate &props);
};
+template<typename T>
+struct CommitterFromProps { };
+
+template<> struct CommitterFromProps<std::monostate> { using type = EaxNullCommitter; };
+template<> struct CommitterFromProps<EAXREVERBPROPERTIES> { using type = EaxReverbCommitter; };
+template<> struct CommitterFromProps<EAXCHORUSPROPERTIES> { using type = EaxChorusCommitter; };
+template<> struct CommitterFromProps<EAXAGCCOMPRESSORPROPERTIES> { using type = EaxCompressorCommitter; };
+template<> struct CommitterFromProps<EAXAUTOWAHPROPERTIES> { using type = EaxAutowahCommitter; };
+template<> struct CommitterFromProps<EAXDISTORTIONPROPERTIES> { using type = EaxDistortionCommitter; };
+template<> struct CommitterFromProps<EAXECHOPROPERTIES> { using type = EaxEchoCommitter; };
+template<> struct CommitterFromProps<EAXEQUALIZERPROPERTIES> { using type = EaxEqualizerCommitter; };
+template<> struct CommitterFromProps<EAXFLANGERPROPERTIES> { using type = EaxFlangerCommitter; };
+template<> struct CommitterFromProps<EAXFREQUENCYSHIFTERPROPERTIES> { using type = EaxFrequencyShifterCommitter; };
+template<> struct CommitterFromProps<EAXRINGMODULATORPROPERTIES> { using type = EaxModulatorCommitter; };
+template<> struct CommitterFromProps<EAXPITCHSHIFTERPROPERTIES> { using type = EaxPitchShifterCommitter; };
+template<> struct CommitterFromProps<EAXVOCALMORPHERPROPERTIES> { using type = EaxVocalMorpherCommitter; };
+
+template<typename T>
+using CommitterFor = typename CommitterFromProps<std::remove_cv_t<std::remove_reference_t<T>>>::type;
+
class EaxEffect {
public:
@@ -233,51 +315,39 @@ public:
State4 state5_{};
- template<typename T, typename ...Args>
- void call_set_defaults(Args&& ...args)
- { return T::SetDefaults(std::forward<Args>(args)...); }
-
void call_set_defaults(const ALenum altype, EaxEffectProps &props)
{
- if(altype == AL_EFFECT_EAXREVERB)
- return call_set_defaults<EaxReverbCommitter>(props);
- if(altype == AL_EFFECT_CHORUS)
- return call_set_defaults<EaxChorusCommitter>(props);
- if(altype == AL_EFFECT_AUTOWAH)
- return call_set_defaults<EaxAutowahCommitter>(props);
- if(altype == AL_EFFECT_COMPRESSOR)
- return call_set_defaults<EaxCompressorCommitter>(props);
- if(altype == AL_EFFECT_DISTORTION)
- return call_set_defaults<EaxDistortionCommitter>(props);
- if(altype == AL_EFFECT_ECHO)
- return call_set_defaults<EaxEchoCommitter>(props);
- if(altype == AL_EFFECT_EQUALIZER)
- return call_set_defaults<EaxEqualizerCommitter>(props);
- if(altype == AL_EFFECT_FLANGER)
- return call_set_defaults<EaxFlangerCommitter>(props);
- if(altype == AL_EFFECT_FREQUENCY_SHIFTER)
- return call_set_defaults<EaxFrequencyShifterCommitter>(props);
- if(altype == AL_EFFECT_RING_MODULATOR)
- return call_set_defaults<EaxModulatorCommitter>(props);
- if(altype == AL_EFFECT_PITCH_SHIFTER)
- return call_set_defaults<EaxPitchShifterCommitter>(props);
- if(altype == AL_EFFECT_VOCAL_MORPHER)
- return call_set_defaults<EaxVocalMorpherCommitter>(props);
- return call_set_defaults<EaxNullCommitter>(props);
+ switch(altype)
+ {
+ case AL_EFFECT_EAXREVERB: return EaxReverbCommitter::SetDefaults(props);
+ case AL_EFFECT_CHORUS: return EaxChorusCommitter::SetDefaults(props);
+ case AL_EFFECT_AUTOWAH: return EaxAutowahCommitter::SetDefaults(props);
+ case AL_EFFECT_COMPRESSOR: return EaxCompressorCommitter::SetDefaults(props);
+ case AL_EFFECT_DISTORTION: return EaxDistortionCommitter::SetDefaults(props);
+ case AL_EFFECT_ECHO: return EaxEchoCommitter::SetDefaults(props);
+ case AL_EFFECT_EQUALIZER: return EaxEqualizerCommitter::SetDefaults(props);
+ case AL_EFFECT_FLANGER: return EaxFlangerCommitter::SetDefaults(props);
+ case AL_EFFECT_FREQUENCY_SHIFTER: return EaxFrequencyShifterCommitter::SetDefaults(props);
+ case AL_EFFECT_RING_MODULATOR: return EaxModulatorCommitter::SetDefaults(props);
+ case AL_EFFECT_PITCH_SHIFTER: return EaxPitchShifterCommitter::SetDefaults(props);
+ case AL_EFFECT_VOCAL_MORPHER: return EaxVocalMorpherCommitter::SetDefaults(props);
+ case AL_EFFECT_NULL: break;
+ }
+ return EaxNullCommitter::SetDefaults(props);
}
template<typename T>
void init()
{
- call_set_defaults<EaxReverbCommitter>(state1_.d);
+ EaxReverbCommitter::SetDefaults(state1_.d);
state1_.i = state1_.d;
- call_set_defaults<EaxReverbCommitter>(state2_.d);
+ EaxReverbCommitter::SetDefaults(state2_.d);
state2_.i = state2_.d;
- call_set_defaults<EaxReverbCommitter>(state3_.d);
+ EaxReverbCommitter::SetDefaults(state3_.d);
state3_.i = state3_.d;
- call_set_defaults<T>(state4_.d);
+ T::SetDefaults(state4_.d);
state4_.i = state4_.d;
- call_set_defaults<T>(state5_.d);
+ T::SetDefaults(state5_.d);
state5_.i = state5_.d;
}
@@ -285,9 +355,9 @@ public:
{
switch(eax_version)
{
- case 1: call_set_defaults<EaxReverbCommitter>(state1_.d); break;
- case 2: call_set_defaults<EaxReverbCommitter>(state2_.d); break;
- case 3: call_set_defaults<EaxReverbCommitter>(state3_.d); break;
+ case 1: EaxReverbCommitter::SetDefaults(state1_.d); break;
+ case 2: EaxReverbCommitter::SetDefaults(state2_.d); break;
+ case 3: EaxReverbCommitter::SetDefaults(state3_.d); break;
case 4: call_set_defaults(altype, state4_.d); break;
case 5: call_set_defaults(altype, state5_.d); break;
}
@@ -295,47 +365,20 @@ public:
}
-#define EAXCALL(Props, Callable, ...) \
- if(std::holds_alternative<EAXREVERBPROPERTIES>(Props)) \
- return Callable<EaxReverbCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXCHORUSPROPERTIES>(Props)) \
- return Callable<EaxChorusCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXAUTOWAHPROPERTIES>(Props)) \
- return Callable<EaxAutowahCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXAGCCOMPRESSORPROPERTIES>(Props)) \
- return Callable<EaxCompressorCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXDISTORTIONPROPERTIES>(Props)) \
- return Callable<EaxDistortionCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXECHOPROPERTIES>(Props)) \
- return Callable<EaxEchoCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXEQUALIZERPROPERTIES>(Props)) \
- return Callable<EaxEqualizerCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXFLANGERPROPERTIES>(Props)) \
- return Callable<EaxFlangerCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXFREQUENCYSHIFTERPROPERTIES>(Props)) \
- return Callable<EaxFrequencyShifterCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXRINGMODULATORPROPERTIES>(Props)) \
- return Callable<EaxModulatorCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXPITCHSHIFTERPROPERTIES>(Props)) \
- return Callable<EaxPitchShifterCommitter>(__VA_ARGS__); \
- if(std::holds_alternative<EAXVOCALMORPHERPROPERTIES>(Props)) \
- return Callable<EaxVocalMorpherCommitter>(__VA_ARGS__); \
- return Callable<EaxNullCommitter>(__VA_ARGS__)
-
- template<typename T, typename ...Args>
- static void call_set(Args&& ...args)
- { return T::Set(std::forward<Args>(args)...); }
-
static void call_set(const EaxCall &call, EaxEffectProps &props)
- { EAXCALL(props, call_set, call, props); }
+ {
+ return std::visit([&](auto &arg)
+ { return CommitterFor<decltype(arg)>::Set(call, arg); },
+ props);
+ }
void set(const EaxCall &call)
{
switch(call.get_version())
{
- case 1: call_set<EaxReverbCommitter>(call, state1_.d); break;
- case 2: call_set<EaxReverbCommitter>(call, state2_.d); break;
- case 3: call_set<EaxReverbCommitter>(call, state3_.d); break;
+ case 1: EaxReverbCommitter::Set(call, state1_.d); break;
+ case 2: EaxReverbCommitter::Set(call, state2_.d); break;
+ case 3: EaxReverbCommitter::Set(call, state3_.d); break;
case 4: call_set(call, state4_.d); break;
case 5: call_set(call, state5_.d); break;
}
@@ -343,32 +386,32 @@ public:
}
- template<typename T, typename ...Args>
- static void call_get(Args&& ...args)
- { return T::Get(std::forward<Args>(args)...); }
-
static void call_get(const EaxCall &call, const EaxEffectProps &props)
- { EAXCALL(props, call_get, call, props); }
+ {
+ return std::visit([&](auto &arg)
+ { return CommitterFor<decltype(arg)>::Get(call, arg); },
+ props);
+ }
void get(const EaxCall &call)
{
switch(call.get_version())
{
- case 1: call_get<EaxReverbCommitter>(call, state1_.d); break;
- case 2: call_get<EaxReverbCommitter>(call, state2_.d); break;
- case 3: call_get<EaxReverbCommitter>(call, state3_.d); break;
+ case 1: EaxReverbCommitter::Get(call, state1_.d); break;
+ case 2: EaxReverbCommitter::Get(call, state2_.d); break;
+ case 3: EaxReverbCommitter::Get(call, state3_.d); break;
case 4: call_get(call, state4_.d); break;
case 5: call_get(call, state5_.d); break;
}
}
- template<typename T, typename ...Args>
- bool call_commit(Args&& ...args)
- { return T{props_, al_effect_props_}.commit(std::forward<Args>(args)...); }
-
bool call_commit(const EaxEffectProps &props)
- { EAXCALL(props, call_commit, props); }
+ {
+ return std::visit([&](auto &arg)
+ { return CommitterFor<decltype(arg)>{props_, al_effect_props_}.commit(arg); },
+ props);
+ }
bool commit(int eax_version)
{
@@ -383,15 +426,15 @@ public:
{
case 1:
state1_.i = state1_.d;
- ret |= call_commit<EaxReverbCommitter>(state1_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state1_.d);
break;
case 2:
state2_.i = state2_.d;
- ret |= call_commit<EaxReverbCommitter>(state2_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state2_.d);
break;
case 3:
state3_.i = state3_.d;
- ret |= call_commit<EaxReverbCommitter>(state3_.d);
+ ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state3_.d);
break;
case 4:
state4_.i = state4_.d;
diff --git a/al/eax/fx_slots.h b/al/eax/fx_slots.h
index 18b2d3ad..b7ed1031 100644
--- a/al/eax/fx_slots.h
+++ b/al/eax/fx_slots.h
@@ -25,11 +25,9 @@ public:
}
- const ALeffectslot& get(
- EaxFxSlotIndex index) const;
+ [[nodiscard]] auto get(EaxFxSlotIndex index) const -> const ALeffectslot&;
- ALeffectslot& get(
- EaxFxSlotIndex index);
+ [[nodiscard]] auto get(EaxFxSlotIndex index) -> ALeffectslot&;
private:
using Items = std::array<EaxAlEffectSlotUPtr, EAX_MAX_FXSLOTS>;
@@ -39,8 +37,7 @@ private:
[[noreturn]]
- static void fail(
- const char* message);
+ static void fail(const char* message);
void initialize_fx_slots(ALCcontext& al_context);
}; // EaxFxSlots
diff --git a/al/eax/globals.h b/al/eax/globals.h
index ff05d009..4d501ff9 100644
--- a/al/eax/globals.h
+++ b/al/eax/globals.h
@@ -3,6 +3,7 @@
inline bool eax_g_is_enabled{true};
+/* NOLINTBEGIN(*-avoid-c-arrays) */
inline constexpr char eax1_ext_name[]{"EAX"};
inline constexpr char eax2_ext_name[]{"EAX2.0"};
inline constexpr char eax3_ext_name[]{"EAX3.0"};
@@ -16,5 +17,6 @@ inline constexpr char eax_eax_get_func_name[]{"EAXGet"};
inline constexpr char eax_eax_set_buffer_mode_func_name[]{"EAXSetBufferMode"};
inline constexpr char eax_eax_get_buffer_mode_func_name[]{"EAXGetBufferMode"};
+/* NOLINTEND(*-avoid-c-arrays) */
#endif // !EAX_GLOBALS_INCLUDED