diff options
author | Chris Robinson <[email protected]> | 2023-05-14 17:53:48 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-14 17:53:48 -0700 |
commit | 6b9b875d6f256c659762073a227032f7e7fcbc02 (patch) | |
tree | af27c2b5c7f382cffc7cb9eed7d7b47d4de8f985 /al/event.cpp | |
parent | 9d60823014c038bd4078fdf47e83118b2a17fc32 (diff) |
Implement direct functions for the listener and events
Diffstat (limited to 'al/event.cpp')
-rw-r--r-- | al/event.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
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<std::mutex> _{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<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{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*) |