Skip to content

Commit

Permalink
Change EAX, UWP, and RTKIT feature defines to 0/1 macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Nov 14, 2024
1 parent 5f2fe8b commit 6a74714
Show file tree
Hide file tree
Showing 35 changed files with 141 additions and 126 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,8 @@ set_target_properties(${IMPL_TARGET} PROPERTIES ${DEFAULT_TARGET_PROPS}
SOVERSION ${LIB_MAJOR_VERSION}
)
target_compile_definitions(${IMPL_TARGET}
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES $<$<BOOL:${ALSOFT_EAX}>:ALSOFT_EAX>
"ALC_API=${EXPORT_DECL}" "AL_API=${EXPORT_DECL}" ${CPP_DEFS})
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES "ALC_API=${EXPORT_DECL}" "AL_API=${EXPORT_DECL}"
${CPP_DEFS})
target_compile_options(${IMPL_TARGET} PRIVATE ${C_FLAGS})

if(TARGET alsoft.build_version)
Expand Down
4 changes: 2 additions & 2 deletions al/auxeffectslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#include "flexarray.h"
#include "opthelpers.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "eax/api.h"
#include "eax/call.h"
#include "eax/effect.h"
Expand Down Expand Up @@ -1004,7 +1004,7 @@ EffectSlotSubList::~EffectSlotSubList()
EffectSlots = nullptr;
}

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
void ALeffectslot::eax_initialize(ALCcontext& al_context, EaxFxSlotIndexValue index)
{
if(index >= EAX_MAX_FXSLOTS)
Expand Down
10 changes: 6 additions & 4 deletions al/auxeffectslot.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef AL_AUXEFFECTSLOT_H
#define AL_AUXEFFECTSLOT_H

#include "config.h"

#include <array>
#include <atomic>
#include <cstdint>
Expand All @@ -16,7 +18,7 @@
#include "core/effectslot.h"
#include "intrusive_ptr.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <memory>
#include "eax/api.h"
#include "eax/call.h"
Expand All @@ -28,7 +30,7 @@

struct ALbuffer;

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
class EaxFxSlotException : public EaxException {
public:
explicit EaxFxSlotException(const char* message)
Expand Down Expand Up @@ -79,7 +81,7 @@ struct ALeffectslot {
static void SetName(ALCcontext *context, ALuint id, std::string_view name);


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
public:
void eax_initialize(ALCcontext& al_context, EaxFxSlotIndexValue index);

Expand Down Expand Up @@ -360,7 +362,7 @@ struct ALeffectslot {

void UpdateAllEffectSlotProps(ALCcontext *context);

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
using EaxAlEffectSlotUPtr = std::unique_ptr<ALeffectslot, ALeffectslot::EaxDeleter>;

EaxAlEffectSlotUPtr eax_create_al_effect_slot(ALCcontext& context);
Expand Down
22 changes: 11 additions & 11 deletions al/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#include "intrusive_ptr.h"
#include "opthelpers.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <unordered_set>

#include "eax/globals.h"
Expand Down Expand Up @@ -113,7 +113,7 @@ constexpr auto EnumFromAmbiScaling(AmbiScaling scale) -> ALenum
throw std::runtime_error{"Invalid AmbiScaling: "+std::to_string(int(scale))};
}

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
constexpr auto EaxStorageFromEnum(ALenum scale) noexcept -> std::optional<EaxStorage>
{
switch(scale)
Expand Down Expand Up @@ -220,7 +220,7 @@ ALbuffer *AllocBuffer(ALCdevice *device) noexcept

void FreeBuffer(ALCdevice *device, ALbuffer *buffer)
{
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
eax_x_ram_clear(*device, *buffer);
#endif // ALSOFT_EAX

Expand Down Expand Up @@ -333,7 +333,7 @@ void LoadData(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsizei fre

const size_t newsize{static_cast<size_t>(blocks) * BlockSize};

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
if(ALBuf->eax_x_ram_mode == EaxStorage::Hardware)
{
ALCdevice &device = *context->mALDevice;
Expand All @@ -360,7 +360,7 @@ void LoadData(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsizei fre
newdata.swap(ALBuf->mDataStorage);
}
ALBuf->mData = ALBuf->mDataStorage;
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
eax_x_ram_clear(*context->mALDevice, *ALBuf);
#endif

Expand All @@ -384,7 +384,7 @@ void LoadData(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsizei fre
ALBuf->mLoopStart = 0;
ALBuf->mLoopEnd = ALBuf->mSampleLen;

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
if(eax_g_is_enabled && ALBuf->eax_x_ram_mode == EaxStorage::Hardware)
eax_x_ram_apply(*context->mALDevice, *ALBuf);
#endif
Expand Down Expand Up @@ -426,7 +426,7 @@ void PrepareCallback(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsi
BufferVectorType(line_blocks*BlockSize).swap(ALBuf->mDataStorage);
ALBuf->mData = ALBuf->mDataStorage;

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
eax_x_ram_clear(*context->mALDevice, *ALBuf);
#endif

Expand Down Expand Up @@ -507,7 +507,7 @@ void PrepareUserPtr(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsiz
throw al::context_error{AL_OUT_OF_MEMORY,
"Buffer size overflow, %d frames x %d bytes per frame", blocks, BlockSize};

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
if(ALBuf->eax_x_ram_mode == EaxStorage::Hardware)
{
ALCdevice &device = *context->mALDevice;
Expand All @@ -521,7 +521,7 @@ void PrepareUserPtr(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsiz
decltype(ALBuf->mDataStorage){}.swap(ALBuf->mDataStorage);
ALBuf->mData = al::span{sdata, sdatalen};

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
eax_x_ram_clear(*context->mALDevice, *ALBuf);
#endif

Expand All @@ -541,7 +541,7 @@ void PrepareUserPtr(ALCcontext *context [[maybe_unused]], ALbuffer *ALBuf, ALsiz
ALBuf->mLoopStart = 0;
ALBuf->mLoopEnd = ALBuf->mSampleLen;

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
if(ALBuf->eax_x_ram_mode == EaxStorage::Hardware)
eax_x_ram_apply(*context->mALDevice, *ALBuf);
#endif
Expand Down Expand Up @@ -1532,7 +1532,7 @@ BufferSubList::~BufferSubList()
}


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
FORCE_ALIGN DECL_FUNC3(ALboolean, EAXSetBufferMode, ALsizei,n, const ALuint*,buffers, ALint,value)
FORCE_ALIGN ALboolean AL_APIENTRY EAXSetBufferModeDirect(ALCcontext *context, ALsizei n,
const ALuint *buffers, ALint value) noexcept
Expand Down
6 changes: 4 additions & 2 deletions al/buffer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef AL_BUFFER_H
#define AL_BUFFER_H

#include "config.h"

#include <array>
#include <atomic>
#include <cstddef>
Expand All @@ -17,7 +19,7 @@
#include "core/buffer_storage.h"
#include "vector.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
enum class EaxStorage : uint8_t {
Automatic,
Accessible,
Expand Down Expand Up @@ -54,7 +56,7 @@ struct ALbuffer : public BufferStorage {

DISABLE_ALLOC

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
EaxStorage eax_x_ram_mode{EaxStorage::Automatic};
bool eax_x_ram_is_hardware{};
#endif // ALSOFT_EAX
Expand Down
4 changes: 2 additions & 2 deletions al/effects/autowah.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax/effect.h"
#include "al/eax/exception.h"
Expand Down Expand Up @@ -103,7 +103,7 @@ void AutowahEffectHandler::GetParamf(const AutowahProps &props, ALenum param, fl
void AutowahEffectHandler::GetParamfv(const AutowahProps &props, ALenum param, float *vals)
{ GetParamf(props, param, vals); }

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using AutowahCommitter = EaxCommitter<EaxAutowahCommitter>;
Expand Down
4 changes: 2 additions & 2 deletions al/effects/chorus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <cassert>
#include "al/eax/effect.h"
#include "al/eax/exception.h"
Expand Down Expand Up @@ -250,7 +250,7 @@ void FlangerEffectHandler::GetParamfv(const ChorusProps &props, ALenum param, fl
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

struct EaxChorusTraits {
Expand Down
5 changes: 2 additions & 3 deletions al/effects/compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#include "alnumeric.h"
#if ALSOFT_EAX
#include "al/eax/effect.h"
#include "al/eax/exception.h"
#include "al/eax/utils.h"
Expand Down Expand Up @@ -74,7 +73,7 @@ void CompressorEffectHandler::GetParamfv(const CompressorProps&, ALenum param, f
}


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using CompressorCommitter = EaxCommitter<EaxCompressorCommitter>;
Expand Down
4 changes: 2 additions & 2 deletions al/effects/distortion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax/effect.h"
#include "al/eax/exception.h"
Expand Down Expand Up @@ -105,7 +105,7 @@ void DistortionEffectHandler::GetParamfv(const DistortionProps &props, ALenum pa
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using DistortionCommitter = EaxCommitter<EaxDistortionCommitter>;
Expand Down
4 changes: 2 additions & 2 deletions al/effects/echo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax/effect.h"
#include "al/eax/exception.h"
Expand Down Expand Up @@ -102,7 +102,7 @@ void EchoEffectHandler::GetParamfv(const EchoProps &props, ALenum param, float *
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using EchoCommitter = EaxCommitter<EaxEchoCommitter>;
Expand Down
4 changes: 2 additions & 2 deletions al/effects/equalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "alnumeric.h"
#include "al/eax/effect.h"
#include "al/eax/exception.h"
Expand Down Expand Up @@ -145,7 +145,7 @@ void EqualizerEffectHandler::GetParamfv(const EqualizerProps &props, ALenum para
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using EqualizerCommitter = EaxCommitter<EaxEqualizerCommitter>;
Expand Down
6 changes: 3 additions & 3 deletions al/effects/fshifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"

#include "al/eax/effect.h"
#include "al/eax/exception.h"
#include "al/eax/utils.h"
Expand Down Expand Up @@ -137,7 +137,7 @@ void FshifterEffectHandler::GetParamfv(const FshifterProps &props, ALenum param,
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using FrequencyShifterCommitter = EaxCommitter<EaxFrequencyShifterCommitter>;
Expand Down
6 changes: 3 additions & 3 deletions al/effects/modulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <cassert>
#include "alnumeric.h"

#include "al/eax/effect.h"
#include "al/eax/exception.h"
#include "al/eax/utils.h"
Expand Down Expand Up @@ -133,7 +133,7 @@ void ModulatorEffectHandler::GetParamfv(const ModulatorProps &props, ALenum para
{ GetParamf(props, param, vals); }


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using ModulatorCommitter = EaxCommitter<EaxModulatorCommitter>;
Expand Down
4 changes: 2 additions & 2 deletions al/effects/null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include "al/eax/effect.h"
#include "al/eax/exception.h"
#endif // ALSOFT_EAX
Expand Down Expand Up @@ -95,7 +95,7 @@ void NullEffectHandler::GetParamfv(const std::monostate &props, ALenum param, fl
}


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using NullCommitter = EaxCommitter<EaxNullCommitter>;
Expand Down
5 changes: 2 additions & 3 deletions al/effects/pshifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "alc/effects/base.h"
#include "effects.h"

#ifdef ALSOFT_EAX
#include "alnumeric.h"
#if ALSOFT_EAX
#include "al/eax/effect.h"
#include "al/eax/exception.h"
#include "al/eax/utils.h"
Expand Down Expand Up @@ -85,7 +84,7 @@ void PshifterEffectHandler::GetParamfv(const PshifterProps&, ALenum param, float
}


#ifdef ALSOFT_EAX
#if ALSOFT_EAX
namespace {

using PitchShifterCommitter = EaxCommitter<EaxPitchShifterCommitter>;
Expand Down
Loading

0 comments on commit 6a74714

Please sign in to comment.