diff options
author | Sven Göthel <sgothel@jausoft.com> | 2024-01-05 13:52:12 +0100 |
---|---|---|
committer | Sven Göthel <sgothel@jausoft.com> | 2024-01-05 13:52:12 +0100 |
commit | ec98cdacc85ff0202852472c7756586437912f22 (patch) | |
tree | 42414746a27ab35cb8cdbc95af521d74821e57f4 /al/filter.h | |
parent | fd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff) | |
parent | b82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff) |
Diffstat (limited to 'al/filter.h')
-rw-r--r-- | al/filter.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/al/filter.h b/al/filter.h index 505900d4..dffe8c6e 100644 --- a/al/filter.h +++ b/al/filter.h @@ -1,6 +1,8 @@ #ifndef AL_FILTER_H #define AL_FILTER_H +#include <array> +#include <cstdint> #include <string_view> #include <variant> @@ -9,10 +11,11 @@ #include "AL/alext.h" #include "almalloc.h" +#include "alnumeric.h" -#define LOWPASSFREQREF 5000.0f -#define HIGHPASSFREQREF 250.0f +inline constexpr float LowPassFreqRef{5000.0f}; +inline constexpr float HighPassFreqRef{250.0f}; template<typename T> struct FilterTable { @@ -38,9 +41,9 @@ struct ALfilter { float Gain{1.0f}; float GainHF{1.0f}; - float HFReference{LOWPASSFREQREF}; + float HFReference{LowPassFreqRef}; float GainLF{1.0f}; - float LFReference{HIGHPASSFREQREF}; + float LFReference{HighPassFreqRef}; using TableTypes = std::variant<NullFilterTable,LowpassFilterTable,HighpassFilterTable, BandpassFilterTable>; @@ -51,7 +54,22 @@ struct ALfilter { static void SetName(ALCcontext *context, ALuint id, std::string_view name); - DISABLE_ALLOC() + DISABLE_ALLOC +}; + +struct FilterSubList { + uint64_t FreeMask{~0_u64}; + gsl::owner<std::array<ALfilter,64>*> Filters{nullptr}; + + FilterSubList() noexcept = default; + FilterSubList(const FilterSubList&) = delete; + FilterSubList(FilterSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Filters{rhs.Filters} + { rhs.FreeMask = ~0_u64; rhs.Filters = nullptr; } + ~FilterSubList(); + + FilterSubList& operator=(const FilterSubList&) = delete; + FilterSubList& operator=(FilterSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Filters, rhs.Filters); return *this; } }; #endif |