diff options
Diffstat (limited to 'al/buffer.h')
-rw-r--r-- | al/buffer.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/al/buffer.h b/al/buffer.h index f936cf98..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" @@ -43,14 +45,14 @@ struct ALbuffer : public BufferStorage { ALuint mLoopEnd{0u}; /* Number of times buffer was attached to a source (deletion can only occur when 0) */ - RefCount ref{0u}; + std::atomic<ALuint> ref{0u}; /* Self ID */ ALuint id{0}; static void SetName(ALCcontext *context, ALuint id, std::string_view name); - DISABLE_ALLOC() + DISABLE_ALLOC #ifdef ALSOFT_EAX EaxStorage eax_x_ram_mode{EaxStorage::Automatic}; @@ -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 |