From 8ae07ad1ae2d957f65ba54fdcd19649eceeb0e3d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 25 Nov 2018 15:30:32 -0800 Subject: Automatically clean up buffers with ther sublist --- OpenAL32/Include/alBuffer.h | 2 -- OpenAL32/Include/alMain.h | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 54c17670..691c7e22 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -121,6 +121,4 @@ struct ALbuffer { ALuint id{0}; }; -ALvoid ReleaseALBuffers(ALCdevice *device); - #endif diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 5ff1e064..eae3ea99 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -551,10 +551,20 @@ typedef union AmbiConfig { } AmbiConfig; -typedef struct BufferSubList { - ALuint64 FreeMask{~ALuint64{}}; +struct BufferSubList { + uint64_t FreeMask{~uint64_t{}}; struct ALbuffer *Buffers{nullptr}; /* 64 */ -} BufferSubList; + + BufferSubList() noexcept = default; + BufferSubList(const BufferSubList&) = delete; + BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers} + { rhs.FreeMask = ~uint64_t{}; 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; } +}; typedef struct EffectSubList { ALuint64 FreeMask{~ALuint64{}}; -- cgit v1.2.3