diff options
Diffstat (limited to 'al/effect.h')
-rw-r--r-- | al/effect.h | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/al/effect.h b/al/effect.h index 27e9dd72..8f069bee 100644 --- a/al/effect.h +++ b/al/effect.h @@ -1,6 +1,9 @@ #ifndef AL_EFFECT_H #define AL_EFFECT_H +#include <array> +#include <bitset> +#include <cstdint> #include <string_view> #include "AL/al.h" @@ -8,6 +11,8 @@ #include "al/effects/effects.h" #include "alc/effects/base.h" +#include "almalloc.h" +#include "alnumeric.h" enum { @@ -29,16 +34,14 @@ enum { MAX_EFFECTS }; -extern bool DisabledEffects[MAX_EFFECTS]; - -extern float ReverbBoost; +inline std::bitset<MAX_EFFECTS> DisabledEffects; struct EffectList { - const char name[16]; - int type; + const char name[16]; /* NOLINT(*-avoid-c-arrays) */ + ALuint type; ALenum val; }; -extern const EffectList gEffectList[16]; +extern const std::array<EffectList,16> gEffectList; struct ALeffect { @@ -47,14 +50,12 @@ struct ALeffect { EffectProps Props{}; - const EffectVtable *vtab{nullptr}; - /* Self ID */ ALuint id{0u}; static void SetName(ALCcontext *context, ALuint id, std::string_view name); - DISABLE_ALLOC() + DISABLE_ALLOC }; void InitEffect(ALeffect *effect); @@ -63,4 +64,19 @@ void LoadReverbPreset(const char *name, ALeffect *effect); bool IsValidEffectType(ALenum type) noexcept; +struct EffectSubList { + uint64_t FreeMask{~0_u64}; + gsl::owner<std::array<ALeffect,64>*> Effects{nullptr}; /* 64 */ + + EffectSubList() noexcept = default; + EffectSubList(const EffectSubList&) = delete; + EffectSubList(EffectSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Effects{rhs.Effects} + { rhs.FreeMask = ~0_u64; rhs.Effects = nullptr; } + ~EffectSubList(); + + EffectSubList& operator=(const EffectSubList&) = delete; + EffectSubList& operator=(EffectSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Effects, rhs.Effects); return *this; } +}; + #endif |