Move ALSOFT_EAX definition to config.h

And disable it by default for non-Windows targets
This commit is contained in:
Chris Robinson 2022-01-30 05:42:44 -08:00
parent c9d59ebc4a
commit 816bd8ab30
44 changed files with 149 additions and 224 deletions

View File

@ -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)

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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{};

View File

@ -5,6 +5,7 @@
// https://github.com/id-Software/DOOM-3/tree/master/neo/openal/include
//
#include "config.h"
#include <algorithm>

View File

@ -1,3 +1,5 @@
#include "config.h"
#include "al/eax_eax_call.h"
#include "al/eax_exception.h"

View File

@ -1 +1,3 @@
#include "config.h"
#include "eax_effect.h"

View File

@ -1,3 +1,5 @@
#include "config.h"
#include "eax_exception.h"
#include <cassert>

View File

@ -1,3 +1,5 @@
#include "config.h"
#include "eax_fx_slot_index.h"
#include "eax_exception.h"

View File

@ -1,3 +1,5 @@
#include "config.h"
#include "eax_fx_slots.h"
#include <array>

View File

@ -1,3 +1,5 @@
#include "config.h"
#include "eax_globals.h"

View File

@ -1,7 +1,8 @@
#include "config.h"
#include "eax_utils.h"
#include <cassert>
#include <exception>
#include "core/logging.h"

View File

@ -1 +1,3 @@
#include "config.h"
#include "eax_x_ram.h"

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)
:

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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."

View File

@ -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;

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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