aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h6
-rw-r--r--OpenAL32/alEffect.cpp24
-rw-r--r--OpenAL32/alState.cpp5
3 files changed, 17 insertions, 18 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index a8c7f3cd..7019a6d4 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -33,12 +33,6 @@
#include "hrtf.h"
-template<typename T, size_t N>
-constexpr inline size_t countof(const T(&)[N]) noexcept
-{ return N; }
-#define COUNTOF countof
-
-
#ifndef UNUSED
#if defined(__cplusplus)
#define UNUSED(x)
diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp
index 36a09442..51474af0 100644
--- a/OpenAL32/alEffect.cpp
+++ b/OpenAL32/alEffect.cpp
@@ -320,11 +320,17 @@ START_API_FUNC
{
if(param == AL_EFFECT_TYPE)
{
- ALboolean isOk = (value == AL_EFFECT_NULL);
- for(size_t i{0u};!isOk && i < countof(gEffectList);i++)
+ ALboolean isOk{value == AL_EFFECT_NULL};
+ if(!isOk)
{
- if(value == gEffectList[i].val && !DisabledEffects[gEffectList[i].type])
- isOk = AL_TRUE;
+ for(const EffectList &effectitem : gEffectList)
+ {
+ if(value == effectitem.val && !DisabledEffects[effectitem.type])
+ {
+ isOk = AL_TRUE;
+ break;
+ }
+ }
}
if(isOk)
@@ -669,8 +675,6 @@ static const struct {
void LoadReverbPreset(const char *name, ALeffect *effect)
{
- size_t i;
-
if(strcasecmp(name, "NONE") == 0)
{
InitEffectParams(effect, AL_EFFECT_NULL);
@@ -684,15 +688,15 @@ void LoadReverbPreset(const char *name, ALeffect *effect)
InitEffectParams(effect, AL_EFFECT_REVERB);
else
InitEffectParams(effect, AL_EFFECT_NULL);
- for(i = 0;i < COUNTOF(reverblist);i++)
+ for(const auto &reverbitem : reverblist)
{
const EFXEAXREVERBPROPERTIES *props;
- if(strcasecmp(name, reverblist[i].name) != 0)
+ if(strcasecmp(name, reverbitem.name) != 0)
continue;
- TRACE("Loading reverb '%s'\n", reverblist[i].name);
- props = &reverblist[i].props;
+ TRACE("Loading reverb '%s'\n", reverbitem.name);
+ props = &reverbitem.props;
effect->Props.Reverb.Density = props->flDensity;
effect->Props.Reverb.Diffusion = props->flDiffusion;
effect->Props.Reverb.Gain = props->flGain;
diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp
index 3f6a0388..0c447645 100644
--- a/OpenAL32/alState.cpp
+++ b/OpenAL32/alState.cpp
@@ -30,6 +30,7 @@
#include "alu.h"
#include "alError.h"
#include "alexcpt.h"
+#include "alspan.h"
#include "backends/base.h"
@@ -788,7 +789,7 @@ START_API_FUNC
alCubicResampler, alBSinc12Resampler,
alBSinc24Resampler,
};
- static_assert(COUNTOF(ResamplerNames) == ResamplerMax+1, "Incorrect ResamplerNames list");
+ static_assert(al::size(ResamplerNames) == ResamplerMax+1, "Incorrect ResamplerNames list");
ContextRef context{GetContextRef()};
if(UNLIKELY(!context)) return nullptr;
@@ -797,7 +798,7 @@ START_API_FUNC
switch(pname)
{
case AL_RESAMPLER_NAME_SOFT:
- if(index < 0 || static_cast<size_t>(index) >= COUNTOF(ResamplerNames))
+ if(index < 0 || static_cast<size_t>(index) >= al::size(ResamplerNames))
alSetError(context.get(), AL_INVALID_VALUE, "Resampler name index %d out of range",
index);
else