Add exception protection to some AL functions
This commit is contained in:
parent
d6f72b777a
commit
f39d4598b7
@ -32,6 +32,7 @@
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alError.h"
|
||||
#include "alexcpt.h"
|
||||
|
||||
ALboolean TrapALError = AL_FALSE;
|
||||
|
||||
@ -80,6 +81,7 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
|
||||
}
|
||||
|
||||
AL_API ALenum AL_APIENTRY alGetError(void)
|
||||
START_API_FUNC
|
||||
{
|
||||
ContextRef context{GetContextRef()};
|
||||
if(UNLIKELY(!context))
|
||||
@ -100,3 +102,4 @@ AL_API ALenum AL_APIENTRY alGetError(void)
|
||||
|
||||
return context->LastError.exchange(AL_NO_ERROR);
|
||||
}
|
||||
END_API_FUNC
|
||||
|
@ -30,8 +30,10 @@
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alError.h"
|
||||
#include "alexcpt.h"
|
||||
|
||||
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
|
||||
START_API_FUNC
|
||||
{
|
||||
ContextRef context{GetContextRef()};
|
||||
if(UNLIKELY(!context)) return AL_FALSE;
|
||||
@ -57,16 +59,21 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
|
||||
|
||||
return AL_FALSE;
|
||||
}
|
||||
END_API_FUNC
|
||||
|
||||
|
||||
AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
|
||||
START_API_FUNC
|
||||
{
|
||||
if(!funcName) return nullptr;
|
||||
return alcGetProcAddress(nullptr, funcName);
|
||||
}
|
||||
END_API_FUNC
|
||||
|
||||
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
|
||||
START_API_FUNC
|
||||
{
|
||||
if(!enumName) return static_cast<ALenum>(0);
|
||||
return alcGetEnumValue(nullptr, enumName);
|
||||
}
|
||||
END_API_FUNC
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "threads.h"
|
||||
#include "alexcpt.h"
|
||||
|
||||
|
||||
static int EventThread(ALCcontext *context)
|
||||
@ -129,6 +130,7 @@ void StopEventThrd(ALCcontext *ctx)
|
||||
}
|
||||
|
||||
AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable)
|
||||
START_API_FUNC
|
||||
{
|
||||
ContextRef context{GetContextRef()};
|
||||
if(UNLIKELY(!context)) return;
|
||||
@ -186,8 +188,10 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
|
||||
std::lock_guard<std::mutex>{context->EventCbLock};
|
||||
}
|
||||
}
|
||||
END_API_FUNC
|
||||
|
||||
AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam)
|
||||
START_API_FUNC
|
||||
{
|
||||
ContextRef context{GetContextRef()};
|
||||
if(UNLIKELY(!context)) return;
|
||||
@ -197,3 +201,4 @@ AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *user
|
||||
context->EventCb = callback;
|
||||
context->EventParam = userParam;
|
||||
}
|
||||
END_API_FUNC
|
||||
|
Loading…
Reference in New Issue
Block a user