aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
Diffstat (limited to 'al')
-rw-r--r--al/auxeffectslot.cpp169
-rw-r--r--al/effect.cpp111
-rw-r--r--al/filter.cpp109
3 files changed, 194 insertions, 195 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 3a3222b8..5fa8fe55 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -47,6 +47,7 @@
#include "core/except.h"
#include "core/fpu_ctrl.h"
#include "core/logging.h"
+#include "direct_defs.h"
#include "effect.h"
#include "opthelpers.h"
@@ -309,11 +310,11 @@ inline void UpdateProps(ALeffectslot *slot, ALCcontext *context)
} // namespace
-AL_API void AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGenAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n,
+ ALuint *effectslots) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Generating %d effect slots", n);
@@ -327,7 +328,7 @@ START_API_FUNC
device->AuxiliaryEffectSlotMax, context->mNumEffectSlots, n);
return;
}
- if(!EnsureEffectSlots(context.get(), static_cast<ALuint>(n)))
+ if(!EnsureEffectSlots(context, static_cast<ALuint>(n)))
{
context->setError(AL_OUT_OF_MEMORY, "Failed to allocate %d effectslot%s", n,
(n==1) ? "" : "s");
@@ -336,7 +337,7 @@ START_API_FUNC
if(n == 1)
{
- ALeffectslot *slot{AllocEffectSlot(context.get())};
+ ALeffectslot *slot{AllocEffectSlot(context)};
effectslots[0] = slot->id;
}
else
@@ -345,19 +346,18 @@ START_API_FUNC
ALsizei count{n};
ids.reserve(static_cast<ALuint>(count));
do {
- ALeffectslot *slot{AllocEffectSlot(context.get())};
+ ALeffectslot *slot{AllocEffectSlot(context)};
ids.emplace_back(slot->id);
} while(--count);
std::copy(ids.cbegin(), ids.cend(), effectslots);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alDeleteAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n,
+ const ALuint *effectslots) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Deleting %d effect slots", n);
@@ -366,7 +366,7 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
if(n == 1)
{
- ALeffectslot *slot{LookupEffectSlot(context.get(), effectslots[0])};
+ ALeffectslot *slot{LookupEffectSlot(context, effectslots[0])};
if(!slot) UNLIKELY
{
context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslots[0]);
@@ -378,15 +378,15 @@ START_API_FUNC
effectslots[0]);
return;
}
- RemoveActiveEffectSlots({&slot, 1u}, context.get());
- FreeEffectSlot(context.get(), slot);
+ RemoveActiveEffectSlots({&slot, 1u}, context);
+ FreeEffectSlot(context, slot);
}
else
{
auto slots = std::vector<ALeffectslot*>(static_cast<ALuint>(n));
for(size_t i{0};i < slots.size();++i)
{
- ALeffectslot *slot{LookupEffectSlot(context.get(), effectslots[i])};
+ ALeffectslot *slot{LookupEffectSlot(context, effectslots[i])};
if(!slot) UNLIKELY
{
context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslots[i]);
@@ -410,26 +410,23 @@ START_API_FUNC
slots.erase(slots_end, slots.end());
/* All effectslots are valid, remove and delete them */
- RemoveActiveEffectSlots(slots, context.get());
+ RemoveActiveEffectSlots(slots, context);
for(ALeffectslot *slot : slots)
- FreeEffectSlot(context.get(), slot);
+ FreeEffectSlot(context, slot);
}
}
-END_API_FUNC
-AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot)
-START_API_FUNC
+FORCE_ALIGN ALboolean AL_APIENTRY alIsAuxiliaryEffectSlotDirect(ALCcontext *context,
+ ALuint effectslot) noexcept
{
- ContextRef context{GetContextRef()};
if(context) LIKELY
{
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- if(LookupEffectSlot(context.get(), effectslot) != nullptr)
+ if(LookupEffectSlot(context, effectslot) != nullptr)
return AL_TRUE;
}
return AL_FALSE;
}
-END_API_FUNC
AL_API void AL_APIENTRY alAuxiliaryEffectSlotPlaySOFT(ALuint slotid)
@@ -541,15 +538,15 @@ START_API_FUNC
END_API_FUNC
-AL_API void AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alAuxiliaryEffectSlotiDirect(ALCcontext *context, ALuint effectslot,
+ ALenum param, ALint value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -565,12 +562,12 @@ START_API_FUNC
std::lock_guard<std::mutex> ___{device->EffectLock};
ALeffect *effect{value ? LookupEffect(device, static_cast<ALuint>(value)) : nullptr};
if(effect)
- err = slot->initEffect(effect->type, effect->Props, context.get());
+ err = slot->initEffect(effect->type, effect->Props, context);
else
{
if(value != 0)
return context->setError(AL_INVALID_VALUE, "Invalid effect ID %u", value);
- err = slot->initEffect(AL_EFFECT_NULL, EffectProps{}, context.get());
+ err = slot->initEffect(AL_EFFECT_NULL, EffectProps{}, context);
}
}
if(err != AL_NO_ERROR) UNLIKELY
@@ -581,9 +578,9 @@ START_API_FUNC
if(slot->mState == SlotState::Initial) UNLIKELY
{
slot->mPropsDirty = false;
- slot->updateProps(context.get());
+ slot->updateProps(context);
- AddActiveEffectSlots({&slot, 1}, context.get());
+ AddActiveEffectSlots({&slot, 1}, context);
slot->mState = SlotState::Playing;
return;
}
@@ -599,7 +596,7 @@ START_API_FUNC
break;
case AL_EFFECTSLOT_TARGET_SOFT:
- target = LookupEffectSlot(context.get(), static_cast<ALuint>(value));
+ target = LookupEffectSlot(context, static_cast<ALuint>(value));
if(value && !target)
return context->setError(AL_INVALID_VALUE, "Invalid effect slot target ID");
if(slot->Target == target) UNLIKELY
@@ -623,7 +620,7 @@ START_API_FUNC
if(target) IncrementRef(target->ref);
DecrementRef(oldtarget->ref);
slot->Target = target;
- slot->updateProps(context.get());
+ slot->updateProps(context);
return;
}
@@ -677,12 +674,11 @@ START_API_FUNC
return context->setError(AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x",
param);
}
- UpdateProps(slot, context.get());
+ UpdateProps(slot, context);
}
-END_API_FUNC
-AL_API void AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alAuxiliaryEffectSlotivDirect(ALCcontext *context, ALuint effectslot,
+ ALenum param, const ALint *values) noexcept
{
switch(param)
{
@@ -691,15 +687,15 @@ START_API_FUNC
case AL_EFFECTSLOT_TARGET_SOFT:
case AL_EFFECTSLOT_STATE_SOFT:
case AL_BUFFER:
- alAuxiliaryEffectSloti(effectslot, param, values[0]);
+ alAuxiliaryEffectSlotiDirect(context, effectslot, param, values[0]);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -710,17 +706,16 @@ START_API_FUNC
"Invalid effect slot integer-vector property 0x%04x", param);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alAuxiliaryEffectSlotfDirect(ALCcontext *context, ALuint effectslot,
+ ALenum param, ALfloat value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -738,25 +733,24 @@ START_API_FUNC
return context->setError(AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x",
param);
}
- UpdateProps(slot, context.get());
+ UpdateProps(slot, context);
}
-END_API_FUNC
-AL_API void AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alAuxiliaryEffectSlotfvDirect(ALCcontext *context, ALuint effectslot,
+ ALenum param, const ALfloat *values) noexcept
{
switch(param)
{
case AL_EFFECTSLOT_GAIN:
- alAuxiliaryEffectSlotf(effectslot, param, values[0]);
+ alAuxiliaryEffectSlotfDirect(context, effectslot, param, values[0]);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -767,17 +761,16 @@ START_API_FUNC
"Invalid effect slot float-vector property 0x%04x", param);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetAuxiliaryEffectSlotiDirect(ALCcontext *context,
+ ALuint effectslot, ALenum param, ALint *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -809,10 +802,9 @@ START_API_FUNC
context->setError(AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x", param);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetAuxiliaryEffectSlotivDirect(ALCcontext *context,
+ ALuint effectslot, ALenum param, ALint *values) noexcept
{
switch(param)
{
@@ -821,15 +813,15 @@ START_API_FUNC
case AL_EFFECTSLOT_TARGET_SOFT:
case AL_EFFECTSLOT_STATE_SOFT:
case AL_BUFFER:
- alGetAuxiliaryEffectSloti(effectslot, param, values);
+ alGetAuxiliaryEffectSlotiDirect(context, effectslot, param, values);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -840,16 +832,15 @@ START_API_FUNC
param);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetAuxiliaryEffectSlotfDirect(ALCcontext *context,
+ ALuint effectslot, ALenum param, ALfloat *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -863,23 +854,22 @@ START_API_FUNC
context->setError(AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x", param);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetAuxiliaryEffectSlotfvDirect(ALCcontext *context,
+ ALuint effectslot, ALenum param, ALfloat *values) noexcept
{
switch(param)
{
case AL_EFFECTSLOT_GAIN:
- alGetAuxiliaryEffectSlotf(effectslot, param, values);
+ alGetAuxiliaryEffectSlotfDirect(context, effectslot, param, values);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
- ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
+ ALeffectslot *slot = LookupEffectSlot(context, effectslot);
if(!slot) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslot);
@@ -890,7 +880,18 @@ START_API_FUNC
param);
}
}
-END_API_FUNC
+
+DECL_FUNC2(void, alGenAuxiliaryEffectSlots, ALsizei, ALuint*)
+DECL_FUNC2(void, alDeleteAuxiliaryEffectSlots, ALsizei, const ALuint*)
+DECL_FUNC1(ALboolean, alIsAuxiliaryEffectSlot, ALuint)
+DECL_FUNC3(void, alAuxiliaryEffectSlotf, ALuint, ALenum, ALfloat)
+DECL_FUNC3(void, alAuxiliaryEffectSlotfv, ALuint, ALenum, const ALfloat*)
+DECL_FUNC3(void, alAuxiliaryEffectSloti, ALuint, ALenum, ALint)
+DECL_FUNC3(void, alAuxiliaryEffectSlotiv, ALuint, ALenum, const ALint*)
+DECL_FUNC3(void, alGetAuxiliaryEffectSlotf, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetAuxiliaryEffectSlotfv, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetAuxiliaryEffectSloti, ALuint, ALenum, ALint*)
+DECL_FUNC3(void, alGetAuxiliaryEffectSlotiv, ALuint, ALenum, ALint*)
ALeffectslot::ALeffectslot(ALCcontext *context)
diff --git a/al/effect.cpp b/al/effect.cpp
index 3ca7c37e..a0ec2135 100644
--- a/al/effect.cpp
+++ b/al/effect.cpp
@@ -49,6 +49,7 @@
#include "alstring.h"
#include "core/except.h"
#include "core/logging.h"
+#include "direct_defs.h"
#include "opthelpers.h"
#ifdef ALSOFT_EAX
@@ -230,11 +231,10 @@ inline ALeffect *LookupEffect(ALCdevice *device, ALuint id)
} // namespace
-AL_API void AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGenEffectsDirect(ALCcontext *context, ALsizei n, ALuint *effects) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Generating %d effects", n);
@@ -268,13 +268,12 @@ START_API_FUNC
std::copy(ids.cbegin(), ids.cend(), effects);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alDeleteEffectsDirect(ALCcontext *context, ALsizei n,
+ const ALuint *effects) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Deleting %d effects", n);
@@ -303,12 +302,9 @@ START_API_FUNC
};
std::for_each(effects, effects_end, delete_effect);
}
-END_API_FUNC
-AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
-START_API_FUNC
+FORCE_ALIGN ALboolean AL_APIENTRY alIsEffectDirect(ALCcontext *context, ALuint effect) noexcept
{
- ContextRef context{GetContextRef()};
if(context) LIKELY
{
ALCdevice *device{context->mALDevice.get()};
@@ -318,13 +314,12 @@ START_API_FUNC
}
return AL_FALSE;
}
-END_API_FUNC
-AL_API void AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alEffectiDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALint value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -361,20 +356,19 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alEffectivDirect(ALCcontext *context, ALuint effect, ALenum param,
+ const ALint *values) noexcept
{
switch(param)
{
case AL_EFFECT_TYPE:
- alEffecti(effect, param, values[0]);
+ alEffectiDirect(context, effect, param, values[0]);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -391,13 +385,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alEffectfDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALfloat value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -414,13 +407,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param,
+ const ALfloat *values) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -437,13 +429,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetEffectiDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALint *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -462,20 +453,19 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetEffectivDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALint *values) noexcept
{
switch(param)
{
case AL_EFFECT_TYPE:
- alGetEffecti(effect, param, values);
+ alGetEffectiDirect(context, effect, param, values);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -492,13 +482,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetEffectfDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALfloat *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -515,13 +504,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param,
+ ALfloat *values) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->EffectLock};
@@ -538,7 +526,18 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
+
+DECL_FUNC2(void, alGenEffects, ALsizei, ALuint*)
+DECL_FUNC2(void, alDeleteEffects, ALsizei, const ALuint*)
+DECL_FUNC1(ALboolean, alIsEffect, ALuint)
+DECL_FUNC3(void, alEffectf, ALuint, ALenum, ALfloat)
+DECL_FUNC3(void, alEffectfv, ALuint, ALenum, const ALfloat*)
+DECL_FUNC3(void, alEffecti, ALuint, ALenum, ALint)
+DECL_FUNC3(void, alEffectiv, ALuint, ALenum, const ALint*)
+DECL_FUNC3(void, alGetEffectf, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetEffectfv, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetEffecti, ALuint, ALenum, ALint*)
+DECL_FUNC3(void, alGetEffectiv, ALuint, ALenum, ALint*)
void InitEffect(ALeffect *effect)
diff --git a/al/filter.cpp b/al/filter.cpp
index 11d71179..9176a516 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -43,6 +43,7 @@
#include "almalloc.h"
#include "alnumeric.h"
#include "core/except.h"
+#include "direct_defs.h"
#include "opthelpers.h"
@@ -401,11 +402,10 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id)
} // namespace
-AL_API void AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGenFiltersDirect(ALCcontext *context, ALsizei n, ALuint *filters) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Generating %d filters", n);
@@ -439,13 +439,12 @@ START_API_FUNC
std::copy(ids.begin(), ids.end(), filters);
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alDeleteFiltersDirect(ALCcontext *context, ALsizei n,
+ const ALuint *filters) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Deleting %d filters", n);
@@ -474,12 +473,9 @@ START_API_FUNC
};
std::for_each(filters, filters_end, delete_filter);
}
-END_API_FUNC
-AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter)
-START_API_FUNC
+FORCE_ALIGN ALboolean AL_APIENTRY alIsFilterDirect(ALCcontext *context, ALuint filter) noexcept
{
- ContextRef context{GetContextRef()};
if(context) LIKELY
{
ALCdevice *device{context->mALDevice.get()};
@@ -489,14 +485,13 @@ START_API_FUNC
}
return AL_FALSE;
}
-END_API_FUNC
-AL_API void AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alFilteriDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALint value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -524,20 +519,19 @@ START_API_FUNC
}
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alFilterivDirect(ALCcontext *context, ALuint filter, ALenum param,
+ const ALint *values) noexcept
{
switch(param)
{
case AL_FILTER_TYPE:
- alFilteri(filter, param, values[0]);
+ alFilteriDirect(context, filter, param, values[0]);
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -554,13 +548,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alFilterfDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALfloat value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -577,13 +570,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param,
+ const ALfloat *values) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -600,13 +592,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetFilteriDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALint *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -628,10 +619,9 @@ START_API_FUNC
}
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetFilterivDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALint *values) noexcept
{
switch(param)
{
@@ -640,8 +630,8 @@ START_API_FUNC
return;
}
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -658,13 +648,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *value)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetFilterfDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALfloat *value) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -681,13 +670,12 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
-AL_API void AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *values)
-START_API_FUNC
+FORCE_ALIGN void AL_APIENTRY alGetFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param,
+ ALfloat *values) noexcept
{
- ContextRef context{GetContextRef()};
- if(!context) UNLIKELY return;
+ if(!context) UNLIKELY
+ return;
ALCdevice *device{context->mALDevice.get()};
std::lock_guard<std::mutex> _{device->FilterLock};
@@ -704,7 +692,18 @@ START_API_FUNC
context->setError(e.errorCode(), "%s", e.what());
}
}
-END_API_FUNC
+
+DECL_FUNC2(void, alGenFilters, ALsizei, ALuint*)
+DECL_FUNC2(void, alDeleteFilters, ALsizei, const ALuint*)
+DECL_FUNC1(ALboolean, alIsFilter, ALuint)
+DECL_FUNC3(void, alFilterf, ALuint, ALenum, ALfloat)
+DECL_FUNC3(void, alFilterfv, ALuint, ALenum, const ALfloat*)
+DECL_FUNC3(void, alFilteri, ALuint, ALenum, ALint)
+DECL_FUNC3(void, alFilteriv, ALuint, ALenum, const ALint*)
+DECL_FUNC3(void, alGetFilterf, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetFilterfv, ALuint, ALenum, ALfloat*)
+DECL_FUNC3(void, alGetFilteri, ALuint, ALenum, ALint*)
+DECL_FUNC3(void, alGetFilteriv, ALuint, ALenum, ALint*)
FilterSubList::~FilterSubList()