diff options
author | Chris Robinson <[email protected]> | 2023-12-29 09:05:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-29 09:05:47 -0800 |
commit | cfab14287405a0d34f6a0fec1336f46415728fcf (patch) | |
tree | e3b1094949aff49c7f38160d17e543c84c66e669 | |
parent | a6942c271f1b27c79e274bdc87aa370b3bb81cc2 (diff) |
Move struct definitions to more appropriate headers
-rw-r--r-- | al/auxeffectslot.h | 18 | ||||
-rw-r--r-- | al/buffer.h | 17 | ||||
-rw-r--r-- | al/effect.h | 18 | ||||
-rw-r--r-- | al/filter.h | 18 | ||||
-rw-r--r-- | al/source.h | 16 | ||||
-rw-r--r-- | alc/context.h | 33 | ||||
-rw-r--r-- | alc/device.cpp | 3 | ||||
-rw-r--r-- | alc/device.h | 49 |
8 files changed, 95 insertions, 77 deletions
diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index fc474bb4..6946591e 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -3,6 +3,7 @@ #include <atomic> #include <cstddef> +#include <cstdint> #include <string_view> #include "AL/al.h" @@ -12,6 +13,7 @@ #include "alc/device.h" #include "alc/effects/base.h" #include "almalloc.h" +#include "alnumeric.h" #include "atomic.h" #include "core/effectslot.h" #include "intrusive_ptr.h" @@ -367,4 +369,20 @@ EaxAlEffectSlotUPtr eax_create_al_effect_slot(ALCcontext& context); void eax_delete_al_effect_slot(ALCcontext& context, ALeffectslot& effect_slot); #endif // ALSOFT_EAX +struct EffectSlotSubList { + uint64_t FreeMask{~0_u64}; + gsl::owner<std::array<ALeffectslot,64>*> EffectSlots{nullptr}; + + EffectSlotSubList() noexcept = default; + EffectSlotSubList(const EffectSlotSubList&) = delete; + EffectSlotSubList(EffectSlotSubList&& rhs) noexcept + : FreeMask{rhs.FreeMask}, EffectSlots{rhs.EffectSlots} + { rhs.FreeMask = ~0_u64; rhs.EffectSlots = nullptr; } + ~EffectSlotSubList(); + + EffectSlotSubList& operator=(const EffectSlotSubList&) = delete; + EffectSlotSubList& operator=(EffectSlotSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(EffectSlots, rhs.EffectSlots); return *this; } +}; + #endif diff --git a/al/buffer.h b/al/buffer.h index 2bcab6cf..b9e59d68 100644 --- a/al/buffer.h +++ b/al/buffer.h @@ -3,12 +3,14 @@ #include <atomic> #include <cstddef> +#include <cstdint> #include <string_view> #include "AL/al.h" #include "alc/inprogext.h" #include "almalloc.h" +#include "alnumeric.h" #include "atomic.h" #include "core/buffer_storage.h" #include "vector.h" @@ -58,4 +60,19 @@ struct ALbuffer : public BufferStorage { #endif // ALSOFT_EAX }; +struct BufferSubList { + uint64_t FreeMask{~0_u64}; + gsl::owner<std::array<ALbuffer,64>*> Buffers{nullptr}; + + BufferSubList() noexcept = default; + BufferSubList(const BufferSubList&) = delete; + BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers} + { rhs.FreeMask = ~0_u64; rhs.Buffers = nullptr; } + ~BufferSubList(); + + BufferSubList& operator=(const BufferSubList&) = delete; + BufferSubList& operator=(BufferSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; } +}; + #endif diff --git a/al/effect.h b/al/effect.h index 820c7d28..8f069bee 100644 --- a/al/effect.h +++ b/al/effect.h @@ -3,6 +3,7 @@ #include <array> #include <bitset> +#include <cstdint> #include <string_view> #include "AL/al.h" @@ -10,6 +11,8 @@ #include "al/effects/effects.h" #include "alc/effects/base.h" +#include "almalloc.h" +#include "alnumeric.h" enum { @@ -61,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 diff --git a/al/filter.h b/al/filter.h index b87e7f03..20d5e012 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,6 +11,7 @@ #include "AL/alext.h" #include "almalloc.h" +#include "alnumeric.h" #define LOWPASSFREQREF 5000.0f #define HIGHPASSFREQREF 250.0f @@ -54,4 +57,19 @@ struct ALfilter { 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 diff --git a/al/source.h b/al/source.h index 1a93d927..84fd7664 100644 --- a/al/source.h +++ b/al/source.h @@ -4,6 +4,7 @@ #include <array> #include <atomic> #include <cstddef> +#include <cstdint> #include <deque> #include <iterator> #include <limits> @@ -1042,4 +1043,19 @@ private: void UpdateAllSourceProps(ALCcontext *context); +struct SourceSubList { + uint64_t FreeMask{~0_u64}; + gsl::owner<std::array<ALsource,64>*> Sources{nullptr}; + + SourceSubList() noexcept = default; + SourceSubList(const SourceSubList&) = delete; + SourceSubList(SourceSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Sources{rhs.Sources} + { rhs.FreeMask = ~0_u64; rhs.Sources = nullptr; } + ~SourceSubList(); + + SourceSubList& operator=(const SourceSubList&) = delete; + SourceSubList& operator=(SourceSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Sources, rhs.Sources); return *this; } +}; + #endif diff --git a/alc/context.h b/alc/context.h index d033c08e..86ef140d 100644 --- a/alc/context.h +++ b/alc/context.h @@ -37,6 +37,8 @@ struct ALeffect; struct ALeffectslot; struct ALsource; struct DebugGroup; +struct EffectSlotSubList; +struct SourceSubList; enum class DebugSource : uint8_t; enum class DebugType : uint8_t; @@ -69,37 +71,6 @@ struct DebugLogEntry { }; -struct SourceSubList { - uint64_t FreeMask{~0_u64}; - gsl::owner<std::array<ALsource,64>*> Sources{nullptr}; - - SourceSubList() noexcept = default; - SourceSubList(const SourceSubList&) = delete; - SourceSubList(SourceSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Sources{rhs.Sources} - { rhs.FreeMask = ~0_u64; rhs.Sources = nullptr; } - ~SourceSubList(); - - SourceSubList& operator=(const SourceSubList&) = delete; - SourceSubList& operator=(SourceSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(Sources, rhs.Sources); return *this; } -}; - -struct EffectSlotSubList { - uint64_t FreeMask{~0_u64}; - gsl::owner<std::array<ALeffectslot,64>*> EffectSlots{nullptr}; - - EffectSlotSubList() noexcept = default; - EffectSlotSubList(const EffectSlotSubList&) = delete; - EffectSlotSubList(EffectSlotSubList&& rhs) noexcept - : FreeMask{rhs.FreeMask}, EffectSlots{rhs.EffectSlots} - { rhs.FreeMask = ~0_u64; rhs.EffectSlots = nullptr; } - ~EffectSlotSubList(); - - EffectSlotSubList& operator=(const EffectSlotSubList&) = delete; - EffectSlotSubList& operator=(EffectSlotSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(EffectSlots, rhs.EffectSlots); return *this; } -}; - struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { const al::intrusive_ptr<ALCdevice> mALDevice; diff --git a/alc/device.cpp b/alc/device.cpp index f13e6071..fc145579 100644 --- a/alc/device.cpp +++ b/alc/device.cpp @@ -6,6 +6,9 @@ #include <cstddef> #include <numeric> +#include "al/buffer.h" +#include "al/effect.h" +#include "al/filter.h" #include "albit.h" #include "alconfig.h" #include "backends/base.h" diff --git a/alc/device.h b/alc/device.h index fe9dff67..dd9335dc 100644 --- a/alc/device.h +++ b/alc/device.h @@ -30,56 +30,13 @@ struct ALbuffer; struct ALeffect; struct ALfilter; struct BackendBase; +struct BufferSubList; +struct EffectSubList; +struct FilterSubList; using uint = unsigned int; -struct BufferSubList { - uint64_t FreeMask{~0_u64}; - gsl::owner<std::array<ALbuffer,64>*> Buffers{nullptr}; - - BufferSubList() noexcept = default; - BufferSubList(const BufferSubList&) = delete; - BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers} - { rhs.FreeMask = ~0_u64; rhs.Buffers = nullptr; } - ~BufferSubList(); - - BufferSubList& operator=(const BufferSubList&) = delete; - BufferSubList& operator=(BufferSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; } -}; - -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; } -}; - -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; } -}; - - struct ALCdevice : public al::intrusive_ref<ALCdevice>, DeviceBase { /* This lock protects the device state (format, update size, etc) from * being from being changed in multiple threads, or being accessed while |