From 6b9b875d6f256c659762073a227032f7e7fcbc02 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 14 May 2023 17:53:48 -0700 Subject: Implement direct functions for the listener and events --- al/event.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'al/event.cpp') diff --git a/al/event.cpp b/al/event.cpp index eb6af45c..f7ef7b50 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -27,6 +27,7 @@ #include "core/logging.h" #include "core/voice_change.h" #include "debug.h" +#include "direct_defs.h" #include "opthelpers.h" #include "ringbuffer.h" #include "threads.h" @@ -172,11 +173,11 @@ void StopEventThrd(ALCcontext *ctx) ctx->mEventThread.join(); } -AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) -START_API_FUNC +FORCE_ALIGN void AL_APIENTRY alEventControlDirectSOFT(ALCcontext *context, ALsizei count, + const ALenum *types, ALboolean enable) noexcept { - ContextRef context{GetContextRef()}; - if(!context) UNLIKELY return; + if(!context) UNLIKELY + return; if(count < 0) context->setError(AL_INVALID_VALUE, "Controlling %d events", count); if(count <= 0) return; @@ -225,17 +226,18 @@ START_API_FUNC std::lock_guard _{context->mEventCbLock}; } } -END_API_FUNC -AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam) -START_API_FUNC +FORCE_ALIGN void AL_APIENTRY alEventCallbackDirectSOFT(ALCcontext *context, + ALEVENTPROCSOFT callback, void *userParam) noexcept { - ContextRef context{GetContextRef()}; - if(!context) UNLIKELY return; + if(!context) UNLIKELY + return; std::lock_guard _{context->mPropLock}; std::lock_guard __{context->mEventCbLock}; context->mEventCb = callback; context->mEventParam = userParam; } -END_API_FUNC + +DECL_FUNCEXT3(void, alEventControl,SOFT, ALsizei, const ALenum*, ALboolean) +DECL_FUNCEXT2(void, alEventCallback,SOFT, ALEVENTPROCSOFT, void*) -- cgit v1.2.3