aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alEffect.h1
-rw-r--r--OpenAL32/Include/alFilter.h9
-rw-r--r--OpenAL32/Include/alMain.h32
-rw-r--r--OpenAL32/alEffect.cpp26
-rw-r--r--OpenAL32/alFilter.cpp26
5 files changed, 44 insertions, 50 deletions
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h
index 38540cfc..441a8e97 100644
--- a/OpenAL32/Include/alEffect.h
+++ b/OpenAL32/Include/alEffect.h
@@ -199,7 +199,6 @@ inline ALboolean IsReverbEffect(ALenum type)
{ return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
void InitEffect(ALeffect *effect);
-void ReleaseALEffects(ALCdevice *device);
void LoadReverbPreset(const char *name, ALeffect *effect);
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 2634d5e8..feca54e3 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -4,9 +4,6 @@
#include "AL/alc.h"
#include "AL/al.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
#define LOWPASSFREQREF (5000.0f)
#define HIGHPASSFREQREF (250.0f)
@@ -58,10 +55,4 @@ typedef struct ALfilter {
#define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v))
#define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v))
-void ReleaseALFilters(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
#endif
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index eae3ea99..c08f9a09 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -566,15 +566,35 @@ struct BufferSubList {
{ std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; }
};
-typedef struct EffectSubList {
- ALuint64 FreeMask{~ALuint64{}};
+struct EffectSubList {
+ uint64_t FreeMask{~uint64_t{}};
struct ALeffect *Effects{nullptr}; /* 64 */
-} EffectSubList;
-typedef struct FilterSubList {
- ALuint64 FreeMask{~ALuint64{}};
+ EffectSubList() noexcept = default;
+ EffectSubList(const EffectSubList&) = delete;
+ EffectSubList(EffectSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Effects{rhs.Effects}
+ { rhs.FreeMask = ~uint64_t{}; 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{~uint64_t{}};
struct ALfilter *Filters{nullptr}; /* 64 */
-} FilterSubList;
+
+ FilterSubList() noexcept = default;
+ FilterSubList(const FilterSubList&) = delete;
+ FilterSubList(FilterSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Filters{rhs.Filters}
+ { rhs.FreeMask = ~uint64_t{}; 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; }
+};
typedef struct EnumeratedHrtf {
diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp
index 2bc60e24..7f479c83 100644
--- a/OpenAL32/alEffect.cpp
+++ b/OpenAL32/alEffect.cpp
@@ -571,26 +571,18 @@ void InitEffect(ALeffect *effect)
InitEffectParams(effect, AL_EFFECT_NULL);
}
-void ReleaseALEffects(ALCdevice *device)
+EffectSubList::~EffectSubList()
{
- size_t leftover = 0;
- for(auto &sublist : device->EffectList)
+ ALuint64 usemask = ~FreeMask;
+ while(usemask)
{
- ALuint64 usemask = ~sublist.FreeMask;
- while(usemask)
- {
- ALsizei idx = CTZ64(usemask);
- ALeffect *effect = sublist.Effects + idx;
-
- effect->~ALeffect();
- ++leftover;
-
- usemask &= ~(U64(1) << idx);
- }
- sublist.FreeMask = ~usemask;
+ ALsizei idx = CTZ64(usemask);
+ Effects[idx].~ALeffect();
+ usemask &= ~(U64(1) << idx);
}
- if(leftover > 0)
- WARN("(%p) Deleted " SZFMT " Effect%s\n", device, leftover, (leftover==1)?"":"s");
+ FreeMask = ~usemask;
+ al_free(Effects);
+ Effects = nullptr;
}
diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp
index 5b15e7e0..390432cb 100644
--- a/OpenAL32/alFilter.cpp
+++ b/OpenAL32/alFilter.cpp
@@ -622,24 +622,16 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va
}
-void ReleaseALFilters(ALCdevice *device)
+FilterSubList::~FilterSubList()
{
- size_t leftover = 0;
- for(auto &sublist : device->FilterList)
+ ALuint64 usemask = ~FreeMask;
+ while(usemask)
{
- ALuint64 usemask = ~sublist.FreeMask;
- while(usemask)
- {
- ALsizei idx = CTZ64(usemask);
- ALfilter *filter = sublist.Filters + idx;
-
- filter->~ALfilter();
- ++leftover;
-
- usemask &= ~(U64(1) << idx);
- }
- sublist.FreeMask = ~usemask;
+ ALsizei idx = CTZ64(usemask);
+ Filters[idx].~ALfilter();
+ usemask &= ~(U64(1) << idx);
}
- if(leftover > 0)
- WARN("(%p) Deleted " SZFMT " Filter%s\n", device, leftover, (leftover==1)?"":"s");
+ FreeMask = ~usemask;
+ al_free(Filters);
+ Filters = nullptr;
}