aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--al/auxeffectslot.cpp8
-rw-r--r--al/auxeffectslot.h6
-rw-r--r--al/buffer.cpp15
-rw-r--r--al/buffer.h4
-rw-r--r--al/eax_api.cpp1
-rw-r--r--al/eax_eax_call.cpp2
-rw-r--r--al/eax_effect.cpp2
-rw-r--r--al/eax_exception.cpp2
-rw-r--r--al/eax_fx_slot_index.cpp2
-rw-r--r--al/eax_fx_slots.cpp2
-rw-r--r--al/eax_globals.cpp2
-rw-r--r--al/eax_utils.cpp3
-rw-r--r--al/eax_x_ram.cpp2
-rw-r--r--al/effect.cpp7
-rw-r--r--al/effect.h9
-rw-r--r--al/effects/autowah.cpp11
-rw-r--r--al/effects/chorus.cpp11
-rw-r--r--al/effects/compressor.cpp11
-rw-r--r--al/effects/distortion.cpp11
-rw-r--r--al/effects/echo.cpp11
-rw-r--r--al/effects/effects.cpp9
-rw-r--r--al/effects/effects.h4
-rw-r--r--al/effects/equalizer.cpp11
-rw-r--r--al/effects/fshifter.cpp11
-rw-r--r--al/effects/modulator.cpp11
-rw-r--r--al/effects/null.cpp11
-rw-r--r--al/effects/pshifter.cpp11
-rw-r--r--al/effects/reverb.cpp11
-rw-r--r--al/effects/vmorpher.cpp10
-rw-r--r--al/extension.cpp8
-rw-r--r--al/filter.cpp4
-rw-r--r--al/filter.h9
-rw-r--r--al/listener.cpp2
-rw-r--r--al/listener.h2
-rw-r--r--al/source.cpp15
-rw-r--r--al/source.h13
-rw-r--r--al/state.cpp4
-rw-r--r--alc/alc.cpp8
-rw-r--r--alc/context.cpp12
-rw-r--r--alc/context.h28
-rw-r--r--alc/device.h4
-rw-r--r--common/alnumeric.h46
-rw-r--r--config.h.in3
44 files changed, 149 insertions, 224 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9480910b..148090c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,7 +95,7 @@ option(ALSOFT_INSTALL_EXAMPLES "Install example programs (alplay, alstream, ...)
option(ALSOFT_INSTALL_UTILS "Install utility programs (openal-info, alsoft-config, ...)" ON)
option(ALSOFT_UPDATE_BUILD_VERSION "Update git build version info" ON)
-option(ALSOFT_EAX "Enable EAX extensions." ON)
+option(ALSOFT_EAX "Enable EAX extensions." $<BOOL:WIN32>)
if(DEFINED SHARE_INSTALL_DIR)
message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
@@ -1316,7 +1316,6 @@ target_include_directories(common PRIVATE ${OpenAL_BINARY_DIR} ${OpenAL_SOURCE_D
target_compile_definitions(common PRIVATE ${CPP_DEFS})
target_compile_options(common PRIVATE ${C_FLAGS})
set_target_properties(common PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
-target_compile_definitions(common PRIVATE "ALSOFT_EAX=$<BOOL:${ALSOFT_EAX}>")
unset(HAS_ROUTER)
@@ -1438,7 +1437,6 @@ set_target_properties(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
target_compile_definitions(${IMPL_TARGET}
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES "ALC_API=${EXPORT_DECL}" "AL_API=${EXPORT_DECL}"
${CPP_DEFS})
-target_compile_definitions(${IMPL_TARGET} PRIVATE "ALSOFT_EAX=$<BOOL:${ALSOFT_EAX}>")
target_compile_options(${IMPL_TARGET} PRIVATE ${C_FLAGS})
if(TARGET build_version)
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 40949aa3..4382553e 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -50,7 +50,7 @@
#include "effect.h"
#include "opthelpers.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_exception.h"
#include "eax_utils.h"
#endif // ALSOFT_EAX
@@ -1047,10 +1047,8 @@ EffectSlotSubList::~EffectSlotSubList()
EffectSlots = nullptr;
}
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
class EaxFxSlotException :
public EaxException
diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h
index 54f1987d..12213df6 100644
--- a/al/auxeffectslot.h
+++ b/al/auxeffectslot.h
@@ -16,7 +16,7 @@
#include "intrusive_ptr.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <memory>
#include "al/effect.h"
@@ -72,7 +72,7 @@ struct ALeffectslot {
DEF_NEWDEL(ALeffectslot)
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
public:
void eax_initialize(
ALCcontext& al_context,
@@ -258,7 +258,7 @@ private:
void UpdateAllEffectSlotProps(ALCcontext *context);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
class EaxAlEffectSlotDeleter
{
public:
diff --git a/al/buffer.cpp b/al/buffer.cpp
index a4967223..8a5bee25 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -56,7 +56,7 @@
#include "core/voice.h"
#include "opthelpers.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_globals.h"
#include "eax_x_ram.h"
#endif // ALSOFT_EAX
@@ -417,7 +417,7 @@ ALbuffer *AllocBuffer(ALCdevice *device)
void FreeBuffer(ALCdevice *device, ALbuffer *buffer)
{
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (buffer->eax_x_ram_is_hardware)
{
const auto buffer_size = static_cast<ALsizei>(buffer->OriginalSize);
@@ -499,7 +499,7 @@ const ALchar *NameFromUserFmtType(UserFmtType type)
return "<internal type error>";
}
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
bool eax_x_ram_validate_buffer(
ALCdevice& al_device,
ALbuffer& al_buffer)
@@ -731,7 +731,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
ALBuf->mLoopStart = 0;
ALBuf->mLoopEnd = ALBuf->mSampleLen;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (eax_g_is_enabled)
{
eax_x_ram_update_buffer(*context->mALDevice, *ALBuf);
@@ -1006,8 +1006,8 @@ START_API_FUNC
if UNLIKELY(!usrfmt)
context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format);
else
-#if ALSOFT_EAX
{
+#ifdef ALSOFT_EAX
if (eax_g_is_enabled)
{
const auto is_buffer_valid = eax_x_ram_validate_buffer(*device, *albuf);
@@ -1021,9 +1021,7 @@ START_API_FUNC
#endif // ALSOFT_EAX
LoadData(context.get(), albuf, freq, static_cast<ALuint>(size), usrfmt->channels,
usrfmt->type, static_cast<const al::byte*>(data), flags);
-#if ALSOFT_EAX
}
-#endif // ALSOFT_EAX
}
}
END_API_FUNC
@@ -1777,7 +1775,7 @@ BufferSubList::~BufferSubList()
}
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
ALboolean AL_APIENTRY EAXSetBufferMode(
ALsizei n,
const ALuint* buffers,
@@ -1932,5 +1930,4 @@ START_API_FUNC
}
END_API_FUNC
-
#endif // ALSOFT_EAX
diff --git a/al/buffer.h b/al/buffer.h
index 0514d984..8c323bea 100644
--- a/al/buffer.h
+++ b/al/buffer.h
@@ -12,7 +12,7 @@
#include "core/buffer_storage.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_x_ram.h"
#endif // ALSOFT_EAX
@@ -72,7 +72,7 @@ struct ALbuffer : public BufferStorage {
DISABLE_ALLOC()
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
ALenum eax_x_ram_mode{AL_STORAGE_AUTOMATIC};
bool eax_x_ram_is_hardware{};
bool eax_x_ram_is_dirty{};
diff --git a/al/eax_api.cpp b/al/eax_api.cpp
index 9907dd4d..391363ec 100644
--- a/al/eax_api.cpp
+++ b/al/eax_api.cpp
@@ -5,6 +5,7 @@
// https://github.com/id-Software/DOOM-3/tree/master/neo/openal/include
//
+#include "config.h"
#include <algorithm>
diff --git a/al/eax_eax_call.cpp b/al/eax_eax_call.cpp
index e6967ded..e9cb2746 100644
--- a/al/eax_eax_call.cpp
+++ b/al/eax_eax_call.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "al/eax_eax_call.h"
#include "al/eax_exception.h"
diff --git a/al/eax_effect.cpp b/al/eax_effect.cpp
index 72af94fc..9cbf4c13 100644
--- a/al/eax_effect.cpp
+++ b/al/eax_effect.cpp
@@ -1 +1,3 @@
+#include "config.h"
+
#include "eax_effect.h"
diff --git a/al/eax_exception.cpp b/al/eax_exception.cpp
index e3635793..c8ecf79d 100644
--- a/al/eax_exception.cpp
+++ b/al/eax_exception.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "eax_exception.h"
#include <cassert>
diff --git a/al/eax_fx_slot_index.cpp b/al/eax_fx_slot_index.cpp
index dffaef47..484c3499 100644
--- a/al/eax_fx_slot_index.cpp
+++ b/al/eax_fx_slot_index.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "eax_fx_slot_index.h"
#include "eax_exception.h"
diff --git a/al/eax_fx_slots.cpp b/al/eax_fx_slots.cpp
index 41b18f77..63e867ec 100644
--- a/al/eax_fx_slots.cpp
+++ b/al/eax_fx_slots.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "eax_fx_slots.h"
#include <array>
diff --git a/al/eax_globals.cpp b/al/eax_globals.cpp
index e2f4681e..454144a9 100644
--- a/al/eax_globals.cpp
+++ b/al/eax_globals.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "eax_globals.h"
diff --git a/al/eax_utils.cpp b/al/eax_utils.cpp
index 9a8f04f1..67389de4 100644
--- a/al/eax_utils.cpp
+++ b/al/eax_utils.cpp
@@ -1,7 +1,8 @@
+#include "config.h"
+
#include "eax_utils.h"
#include <cassert>
-
#include <exception>
#include "core/logging.h"
diff --git a/al/eax_x_ram.cpp b/al/eax_x_ram.cpp
index d11a03ab..ac3e7ebb 100644
--- a/al/eax_x_ram.cpp
+++ b/al/eax_x_ram.cpp
@@ -1 +1,3 @@
+#include "config.h"
+
#include "eax_x_ram.h"
diff --git a/al/effect.cpp b/al/effect.cpp
index 79cd7fab..e4fe95b3 100644
--- a/al/effect.cpp
+++ b/al/effect.cpp
@@ -51,7 +51,7 @@
#include "opthelpers.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include "eax_exception.h"
@@ -751,9 +751,8 @@ void LoadReverbPreset(const char *name, ALeffect *effect)
WARN("Reverb preset '%s' not found\n", name);
}
-#if ALSOFT_EAX
-namespace
-{
+#ifdef ALSOFT_EAX
+namespace {
class EaxAlEffectException :
public EaxException
diff --git a/al/effect.h b/al/effect.h
index 5b5e4b03..0e4948f7 100644
--- a/al/effect.h
+++ b/al/effect.h
@@ -7,7 +7,7 @@
#include "al/effects/effects.h"
#include "alc/effects/base.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <memory>
#include "eax_effect.h"
@@ -59,7 +59,7 @@ struct ALeffect {
DISABLE_ALLOC()
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
public:
EaxEffectUPtr eax_effect{};
@@ -81,9 +81,8 @@ void InitEffect(ALeffect *effect);
void LoadReverbPreset(const char *name, ALeffect *effect);
-#if ALSOFT_EAX
-class EaxAlEffectDeleter
-{
+#ifdef ALSOFT_EAX
+class EaxAlEffectDeleter {
public:
EaxAlEffectDeleter() noexcept = default;
diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp
index bdd1bc09..6dbafca3 100644
--- a/al/effects/autowah.cpp
+++ b/al/effects/autowah.cpp
@@ -11,7 +11,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -116,10 +116,8 @@ DEFINE_ALEFFECT_VTABLE(Autowah);
const EffectProps AutowahEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxAutoWahEffectDirtyFlagsValue = std::uint_least8_t;
@@ -566,15 +564,12 @@ bool EaxAutoWahEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_auto_wah_effect(
EffectProps& al_effect_props)
{
return std::make_unique<::EaxAutoWahEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp
index ed994fbb..37651406 100644
--- a/al/effects/chorus.cpp
+++ b/al/effects/chorus.cpp
@@ -11,7 +11,7 @@
#include "core/logging.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"
@@ -290,10 +290,8 @@ DEFINE_ALEFFECT_VTABLE(Flanger);
const EffectProps FlangerEffectProps{genDefaultFlangerProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
void eax_set_efx_waveform(
ALenum waveform,
@@ -1507,15 +1505,12 @@ bool EaxFlangerEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_flanger_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxFlangerEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp
index 868c5c1b..a4835178 100644
--- a/al/effects/compressor.cpp
+++ b/al/effects/compressor.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -78,10 +78,8 @@ DEFINE_ALEFFECT_VTABLE(Compressor);
const EffectProps CompressorEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxCompressorEffectDirtyFlagsValue = std::uint_least8_t;
@@ -330,15 +328,12 @@ bool EaxCompressorEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_compressor_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxCompressorEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp
index 062cdc54..d0c9a3c2 100644
--- a/al/effects/distortion.cpp
+++ b/al/effects/distortion.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -120,10 +120,8 @@ DEFINE_ALEFFECT_VTABLE(Distortion);
const EffectProps DistortionEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxDistortionEffectDirtyFlagsValue = std::uint_least8_t;
@@ -636,15 +634,12 @@ bool EaxDistortionEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_distortion_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxDistortionEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp
index 5ceb161d..7e7a38bc 100644
--- a/al/effects/echo.cpp
+++ b/al/effects/echo.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -117,10 +117,8 @@ DEFINE_ALEFFECT_VTABLE(Echo);
const EffectProps EchoEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxEchoEffectDirtyFlagsValue = std::uint_least8_t;
@@ -631,15 +629,12 @@ bool EaxEchoEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_echo_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxEchoEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/effects.cpp b/al/effects/effects.cpp
index 55abfdc5..ede88f91 100644
--- a/al/effects/effects.cpp
+++ b/al/effects/effects.cpp
@@ -1,12 +1,14 @@
-#if ALSOFT_EAX
+#include "config.h"
+
+#ifdef ALSOFT_EAX
+
+#include "effects.h"
#include <cassert>
#include "AL/efx.h"
-#include "effects.h"
-
EaxEffectUPtr eax_create_eax_null_effect();
@@ -102,5 +104,4 @@ EaxEffectUPtr eax_create_eax_effect(
#undef EAX_PREFIX
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/effects.h b/al/effects/effects.h
index 6813beaa..a2ab8485 100644
--- a/al/effects/effects.h
+++ b/al/effects/effects.h
@@ -5,7 +5,7 @@
#include "core/except.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "al/eax_effect.h"
#endif // ALSOFT_EAX
@@ -85,7 +85,7 @@ extern const EffectVtable DedicatedEffectVtable;
extern const EffectVtable ConvolutionEffectVtable;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
EaxEffectUPtr eax_create_eax_effect(
ALenum al_effect_type,
EffectProps& al_effect_props);
diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp
index c052db3e..4ff26178 100644
--- a/al/effects/equalizer.cpp
+++ b/al/effects/equalizer.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -175,10 +175,8 @@ DEFINE_ALEFFECT_VTABLE(Equalizer);
const EffectProps EqualizerEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxEqualizerEffectDirtyFlagsValue = std::uint_least16_t;
@@ -1021,15 +1019,12 @@ bool EaxEqualizerEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_equalizer_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxEqualizerEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp
index aa4ddadb..74ef52d9 100644
--- a/al/effects/fshifter.cpp
+++ b/al/effects/fshifter.cpp
@@ -10,7 +10,7 @@
#include "aloptional.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"
@@ -138,10 +138,8 @@ DEFINE_ALEFFECT_VTABLE(Fshifter);
const EffectProps FshifterEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxFrequencyShifterEffectDirtyFlagsValue = std::uint_least8_t;
@@ -530,15 +528,12 @@ bool EaxFrequencyShifterEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_frequency_shifter_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxFrequencyShifterEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp
index 6a30dc09..c33db8c3 100644
--- a/al/effects/modulator.cpp
+++ b/al/effects/modulator.cpp
@@ -10,7 +10,7 @@
#include "aloptional.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"
@@ -144,10 +144,8 @@ DEFINE_ALEFFECT_VTABLE(Modulator);
const EffectProps ModulatorEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxRingModulatorEffectDirtyFlagsValue = std::uint_least8_t;
@@ -533,15 +531,12 @@ bool EaxRingModulatorEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_ring_modulator_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxRingModulatorEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/null.cpp b/al/effects/null.cpp
index 44595208..8b68eec0 100644
--- a/al/effects/null.cpp
+++ b/al/effects/null.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "al/eax_exception.h"
#endif // ALSOFT_EAX
@@ -97,10 +97,8 @@ DEFINE_ALEFFECT_VTABLE(Null);
const EffectProps NullEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
class EaxNullEffect final :
public EaxEffect
@@ -137,14 +135,11 @@ bool EaxNullEffect::dispatch(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_null_effect()
{
return std::make_unique<EaxNullEffect>();
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp
index 03f9a139..7c355be1 100644
--- a/al/effects/pshifter.cpp
+++ b/al/effects/pshifter.cpp
@@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax_exception.h"
@@ -90,10 +90,8 @@ DEFINE_ALEFFECT_VTABLE(Pshifter);
const EffectProps PshifterEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxPitchShifterEffectDirtyFlagsValue = std::uint_least8_t;
@@ -408,15 +406,12 @@ bool EaxPitchShifterEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_pitch_shifter_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxPitchShifterEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp
index 8012450d..a8404f8b 100644
--- a/al/effects/reverb.cpp
+++ b/al/effects/reverb.cpp
@@ -9,7 +9,7 @@
#include "alc/effects/base.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <tuple>
#include "alnumeric.h"
@@ -564,10 +564,8 @@ DEFINE_ALEFFECT_VTABLE(StdReverb);
const EffectProps StdReverbEffectProps{genDefaultStdProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxReverbEffectDirtyFlagsValue = std::uint_least32_t;
@@ -2464,15 +2462,12 @@ bool EaxReverbEffect::set(
return false;
}
-
} // namespace
-
EaxEffectUPtr eax_create_eax_reverb_effect(
EffectProps& al_effect_props)
{
return std::make_unique<EaxReverbEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp
index 2a9e0702..2ea2594e 100644
--- a/al/effects/vmorpher.cpp
+++ b/al/effects/vmorpher.cpp
@@ -10,7 +10,7 @@
#include "aloptional.h"
#include "effects.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"
@@ -257,10 +257,8 @@ DEFINE_ALEFFECT_VTABLE(Vmorpher);
const EffectProps VmorpherEffectProps{genDefaultProps()};
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
using EaxVocalMorpherEffectDirtyFlagsValue = std::uint_least8_t;
@@ -859,7 +857,6 @@ bool EaxVocalMorpherEffect::set(
return false;
}
-
} // namespace
@@ -869,5 +866,4 @@ EaxEffectUPtr eax_create_eax_vocal_morpher_effect(
return std::make_unique<EaxVocalMorpherEffect>(al_effect_props);
}
-
#endif // ALSOFT_EAX
diff --git a/al/extension.cpp b/al/extension.cpp
index 373f87a9..6d9d181a 100644
--- a/al/extension.cpp
+++ b/al/extension.cpp
@@ -32,7 +32,7 @@
#include "core/except.h"
#include "opthelpers.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_globals.h"
#include "eax_x_ram.h"
#endif // ALSOFT_EAX
@@ -47,7 +47,7 @@ START_API_FUNC
SETERR_RETURN(context, AL_INVALID_VALUE, AL_FALSE, "NULL pointer");
size_t len{strlen(extName)};
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (al::strncasecmp(eax_v2_0_ext_name, extName, len) == 0 ||
al::strncasecmp(eax_v3_0_ext_name, extName, len) == 0 ||
al::strncasecmp(eax_v4_0_ext_name, extName, len) == 0 ||
@@ -86,7 +86,7 @@ AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
START_API_FUNC
{
if(!funcName) return nullptr;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (al::strcasecmp(funcName, eax_eax_set_func_name) == 0)
{
if (!eax_g_is_enabled)
@@ -163,7 +163,7 @@ AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
START_API_FUNC
{
if(!enumName) return static_cast<ALenum>(0);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (eax_g_is_enabled)
{
struct Descriptor
diff --git a/al/filter.cpp b/al/filter.cpp
index 563fb3ef..9989063b 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -45,7 +45,7 @@
#include "opthelpers.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "core/logging.h"
#endif // ALSOFT_EAX
@@ -723,7 +723,7 @@ FilterSubList::~FilterSubList()
}
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
EaxAlFilterDeleter::EaxAlFilterDeleter(
ALCcontext& context)
:
diff --git a/al/filter.h b/al/filter.h
index 222a6917..98c32325 100644
--- a/al/filter.h
+++ b/al/filter.h
@@ -8,7 +8,7 @@
#include "almalloc.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <memory>
#include "eax_utils.h"
@@ -54,7 +54,7 @@ struct ALfilter {
DISABLE_ALLOC()
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
public:
void eax_set_low_pass_params(
ALCcontext& context,
@@ -62,9 +62,8 @@ public:
#endif // ALSOFT_EAX
};
-#if ALSOFT_EAX
-class EaxAlFilterDeleter
-{
+#ifdef ALSOFT_EAX
+class EaxAlFilterDeleter {
public:
EaxAlFilterDeleter() noexcept = default;
diff --git a/al/listener.cpp b/al/listener.cpp
index 1909c644..16c3f6a5 100644
--- a/al/listener.cpp
+++ b/al/listener.cpp
@@ -451,7 +451,7 @@ void UpdateListenerProps(ALCcontext *context)
}
}
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
// `alListenerf(AL_METERS_PER_UNIT, value)`
void eax_set_al_listener_meters_per_unit(
ALCcontext& al_context,
diff --git a/al/listener.h b/al/listener.h
index 05cd3abf..df20ee69 100644
--- a/al/listener.h
+++ b/al/listener.h
@@ -29,7 +29,7 @@ struct ALlistener {
void UpdateListenerProps(ALCcontext *context);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
// `alListenerf(AL_METERS_PER_UNIT, value)`
void eax_set_al_listener_meters_per_unit(
ALCcontext& al_context,
diff --git a/al/source.cpp b/al/source.cpp
index 3f7fa540..a306404c 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -72,7 +72,7 @@
#include "ringbuffer.h"
#include "threads.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_exception.h"
#include "eax_globals.h"
#endif // ALSOFT_EAX
@@ -2419,7 +2419,7 @@ START_API_FUNC
ALsource *source{AllocSource(context.get())};
sources[0] = source->id;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (context->has_eax())
{
std::unique_lock<std::mutex> prop_lock{context->mPropLock};
@@ -2429,7 +2429,7 @@ START_API_FUNC
}
else
{
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
auto eax_sources = al::vector<ALsource*>{};
if (context->has_eax())
@@ -2444,7 +2444,7 @@ START_API_FUNC
ALsource *source{AllocSource(context.get())};
ids.emplace_back(source->id);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (context->has_eax())
{
eax_sources.emplace_back(source);
@@ -2453,7 +2453,7 @@ START_API_FUNC
} while(--n);
std::copy(ids.cbegin(), ids.cend(), sources);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (context->has_eax())
{
std::unique_lock<std::mutex> prop_lock{context->mPropLock};
@@ -3595,7 +3595,7 @@ ALsource::ALsource()
ALsource::~ALsource()
{
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
eax_uninitialize();
#endif // ALSOFT_EAX
@@ -3643,7 +3643,7 @@ SourceSubList::~SourceSubList()
}
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
class EaxSourceException :
public EaxException
{
@@ -6083,5 +6083,4 @@ void ALsource::eax_al_source_3i(
SetSourceiv(this, eax_al_context_, static_cast<SourceProp>(param), values);
}
-
#endif // ALSOFT_EAX
diff --git a/al/source.h b/al/source.h
index 41cd6187..2fbb7b22 100644
--- a/al/source.h
+++ b/al/source.h
@@ -21,7 +21,7 @@
#include "core/voice.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "eax_eax_call.h"
#include "eax_fx_slot_index.h"
#include "eax_utils.h"
@@ -47,11 +47,10 @@ struct ALbufferQueueItem : public VoiceBufferItem {
};
-#if ALSOFT_EAX
-struct EaxSourceInitParam
-{
- ALCcontext* al_context{};
- ALfilter* al_filter{};
+#ifdef ALSOFT_EAX
+struct EaxSourceInitParam {
+ ALCcontext* al_context{};
+ ALfilter* al_filter{};
}; // EaxSourceInitParam
@@ -213,7 +212,7 @@ struct ALsource {
DISABLE_ALLOC()
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
public:
void eax_initialize(
const EaxSourceInitParam& param) noexcept;
diff --git a/al/state.cpp b/al/state.cpp
index 0ec0e280..bd62c4e3 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -46,7 +46,7 @@
#include "opthelpers.h"
#include "strutils.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "alc/device.h"
#include "eax_globals.h"
@@ -434,7 +434,7 @@ START_API_FUNC
value = static_cast<int>(ResamplerDefault);
break;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#define EAX_ERROR "[alGetInteger] EAX not enabled."
diff --git a/alc/alc.cpp b/alc/alc.cpp
index b9f322a3..4effcc67 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -155,7 +155,7 @@
#include "backends/wave.h"
#endif
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "al/eax_globals.h"
#include "al/eax_x_ram.h"
#endif // ALSOFT_EAX
@@ -881,7 +881,7 @@ constexpr struct {
DECL(AL_STOP_SOURCES_ON_DISCONNECT_SOFT),
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
DECL(AL_EAX_RAM_SIZE),
DECL(AL_EAX_RAM_FREE),
DECL(AL_STORAGE_AUTOMATIC),
@@ -1258,7 +1258,7 @@ void alc_initconfig(void)
if(defrevopt || (defrevopt=ConfigValueStr(nullptr, nullptr, "default-reverb")))
LoadReverbPreset(defrevopt->c_str(), &ALCcontext::sDefaultEffect);
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
{
constexpr auto eax_block_name = "eax";
@@ -3223,7 +3223,7 @@ START_API_FUNC
device->AuxiliaryEffectSlotMax = 64;
device->NumAuxSends = DEFAULT_SENDS;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
if (eax_g_is_enabled)
{
device->NumAuxSends = EAX_MAX_FXSLOTS;
diff --git a/alc/context.cpp b/alc/context.cpp
index d5fd94b2..33e9e7e0 100644
--- a/alc/context.cpp
+++ b/alc/context.cpp
@@ -29,7 +29,7 @@
#include "ringbuffer.h"
#include "vecmat.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include <cassert>
#include <cstring>
@@ -129,7 +129,7 @@ ALCcontext::~ALCcontext()
mSourceList.clear();
mNumSources = 0;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
eax_uninitialize();
#endif // ALSOFT_EAX
@@ -172,7 +172,7 @@ void ALCcontext::init()
mExtensionList = alExtList;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
eax_initialize_extensions();
#endif // ALSOFT_EAX
@@ -274,10 +274,8 @@ void ALCcontext::processUpdates()
}
}
-#if ALSOFT_EAX
-namespace
-{
-
+#ifdef ALSOFT_EAX
+namespace {
class ContextException :
public EaxException
diff --git a/alc/context.h b/alc/context.h
index b34807b8..b964d813 100644
--- a/alc/context.h
+++ b/alc/context.h
@@ -19,17 +19,15 @@
#include "intrusive_ptr.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "al/filter.h"
#include "al/eax_eax_call.h"
#include "al/eax_fx_slot_index.h"
#include "al/eax_fx_slots.h"
#include "al/eax_utils.h"
-#endif // ALSOFT_EAX
-#if ALSOFT_EAX
using EaxContextSharedDirtyFlagsValue = std::uint_least8_t;
struct EaxContextSharedDirtyFlags
@@ -206,7 +204,7 @@ public:
DEF_NEWDEL(ALCcontext)
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
public:
bool has_eax() const noexcept;
@@ -549,20 +547,20 @@ void UpdateContextProps(ALCcontext *context);
extern bool TrapALError;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
ALenum AL_APIENTRY EAXSet(
- const GUID* property_set_id,
- ALuint property_id,
- ALuint property_source_id,
- ALvoid* property_value,
- ALuint property_value_size) noexcept;
+ const GUID* property_set_id,
+ ALuint property_id,
+ ALuint property_source_id,
+ ALvoid* property_value,
+ ALuint property_value_size) noexcept;
ALenum AL_APIENTRY EAXGet(
- const GUID* property_set_id,
- ALuint property_id,
- ALuint property_source_id,
- ALvoid* property_value,
- ALuint property_value_size) noexcept;
+ const GUID* property_set_id,
+ ALuint property_id,
+ ALuint property_source_id,
+ ALvoid* property_value,
+ ALuint property_value_size) noexcept;
#endif // ALSOFT_EAX
#endif /* ALC_CONTEXT_H */
diff --git a/alc/device.h b/alc/device.h
index e4eb76ea..daade87a 100644
--- a/alc/device.h
+++ b/alc/device.h
@@ -18,7 +18,7 @@
#include "intrusive_ptr.h"
#include "vector.h"
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
#include "al/eax_x_ram.h"
#endif // ALSOFT_EAX
@@ -110,7 +110,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice>, DeviceBase {
std::mutex FilterLock;
al::vector<FilterSubList> FilterList;
-#if ALSOFT_EAX
+#ifdef ALSOFT_EAX
ALsizei eax_x_ram_free_size{eax_x_ram_max_size};
#endif // ALSOFT_EAX
diff --git a/common/alnumeric.h b/common/alnumeric.h
index d72ba1e3..18df2689 100644
--- a/common/alnumeric.h
+++ b/common/alnumeric.h
@@ -1,10 +1,8 @@
#ifndef AL_NUMERIC_H
#define AL_NUMERIC_H
-#if ALSOFT_EAX
+#include <algorithm>
#include <cmath>
-#endif // ALSOFT_EAX
-
#include <cstddef>
#include <cstdint>
#ifdef HAVE_INTRIN_H
@@ -275,45 +273,27 @@ inline float fast_roundf(float f) noexcept
#endif
}
-#if ALSOFT_EAX
-template<
- typename T
->
-inline constexpr const T& clamp(
- const T& value,
- const T& min_value,
- const T& max_value) noexcept
+
+template<typename T>
+constexpr const T& clamp(const T& value, const T& min_value, const T& max_value) noexcept
{
- return value < min_value ? min_value : (value > max_value ? max_value : value);
+ return std::min(std::max(value, min_value), max_value);
}
// Converts level (mB) to gain.
-inline float level_mb_to_gain(
- float x)
+inline float level_mb_to_gain(float x)
{
- if (x <= -10'000.0F)
- {
- return 0.0F;
- }
- else
- {
- return std::pow(10.0F, x / 2'000.0F);
- }
+ if(x <= -10'000.0f)
+ return 0.0f;
+ return std::pow(10.0f, x / 2'000.0f);
}
// Converts gain to level (mB).
-inline float gain_to_level_mb(
- float x)
+inline float gain_to_level_mb(float x)
{
- if (x <= 0.0F)
- {
- return -10'000.0F;
- }
- else
- {
- return std::log10(x * 2'000.0F);
- }
+ if (x <= 0.0f)
+ return -10'000.0f;
+ return std::log10(x * 2'000.0f);
}
-#endif // ALSOFT_EAX
#endif /* AL_NUMERIC_H */
diff --git a/config.h.in b/config.h.in
index b06314a8..588d45a5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,3 +1,6 @@
+/* Define if deprecated EAX extensions are enabled */
+#cmakedefine ALSOFT_EAX
+
/* Define if HRTF data is embedded in the library */
#cmakedefine ALSOFT_EMBED_HRTF_DATA