Audio: Implement support for ALC_EXT_thread_local_context
This commit is contained in:
@@ -27,6 +27,7 @@ namespace Nz
|
||||
enum class OpenALExtension
|
||||
{
|
||||
SourceLatency,
|
||||
ThreadLocalContext,
|
||||
|
||||
Max = SourceLatency
|
||||
};
|
||||
@@ -82,6 +83,8 @@ namespace Nz
|
||||
OpenALDevice& operator=(const OpenALDevice&) = delete;
|
||||
OpenALDevice& operator=(OpenALDevice&&) = delete;
|
||||
|
||||
static const OpenALDevice* GetCurrentDevice();
|
||||
|
||||
// We give each device its own set of function pointer, even though regular OpenAL extensions are always the same (for a set library).
|
||||
// This makes it easier to wrap them (for error handling), and extension pointers are device-local anyway.
|
||||
#define NAZARA_AUDIO_AL_ALC_FUNCTION(name) decltype(&::name) name;
|
||||
|
||||
@@ -28,6 +28,18 @@
|
||||
#define NAZARA_AUDIO_AL_EXT_END()
|
||||
#endif
|
||||
|
||||
#ifndef NAZARA_AUDIO_ALC_EXT_FUNCTION
|
||||
#define NAZARA_AUDIO_ALC_EXT_FUNCTION(func) NAZARA_AUDIO_AL_EXT_FUNCTION(func)
|
||||
#endif
|
||||
|
||||
#ifndef NAZARA_AUDIO_ALC_EXT_BEGIN
|
||||
#define NAZARA_AUDIO_ALC_EXT_BEGIN(ext) NAZARA_AUDIO_AL_EXT_BEGIN(ext)
|
||||
#endif
|
||||
|
||||
#ifndef NAZARA_AUDIO_ALC_EXT_END
|
||||
#define NAZARA_AUDIO_ALC_EXT_END() NAZARA_AUDIO_AL_EXT_END()
|
||||
#endif
|
||||
|
||||
NAZARA_AUDIO_AL_FUNCTION(alBuffer3f)
|
||||
NAZARA_AUDIO_AL_FUNCTION(alBuffer3i)
|
||||
NAZARA_AUDIO_AL_FUNCTION(alBufferData)
|
||||
@@ -102,7 +114,7 @@ NAZARA_AUDIO_AL_FUNCTION(alSourceStopv)
|
||||
NAZARA_AUDIO_AL_FUNCTION(alSourceUnqueueBuffers)
|
||||
NAZARA_AUDIO_AL_FUNCTION(alSpeedOfSound)
|
||||
|
||||
#ifndef NAZARA_PLATFORM_WEB
|
||||
#ifdef AL_SOFT_source_latency
|
||||
NAZARA_AUDIO_AL_EXT_BEGIN(AL_SOFT_source_latency)
|
||||
NAZARA_AUDIO_AL_EXT_FUNCTION(alGetSource3dSOFT)
|
||||
NAZARA_AUDIO_AL_EXT_FUNCTION(alGetSource3i64SOFT)
|
||||
@@ -140,9 +152,19 @@ NAZARA_AUDIO_ALC_FUNCTION(alcOpenDevice)
|
||||
NAZARA_AUDIO_ALC_FUNCTION(alcProcessContext)
|
||||
NAZARA_AUDIO_ALC_FUNCTION(alcSuspendContext)
|
||||
|
||||
#ifdef ALC_EXT_thread_local_context
|
||||
NAZARA_AUDIO_ALC_EXT_BEGIN(ALC_EXT_thread_local_context)
|
||||
NAZARA_AUDIO_ALC_EXT_FUNCTION(alcGetThreadContext)
|
||||
NAZARA_AUDIO_ALC_EXT_FUNCTION(alcSetThreadContext)
|
||||
NAZARA_AUDIO_ALC_EXT_END()
|
||||
#endif
|
||||
|
||||
#undef NAZARA_AUDIO_AL_FUNCTION
|
||||
#undef NAZARA_AUDIO_AL_ALC_FUNCTION
|
||||
#undef NAZARA_AUDIO_AL_EXT_FUNCTION
|
||||
#undef NAZARA_AUDIO_ALC_FUNCTION
|
||||
#undef NAZARA_AUDIO_AL_EXT_BEGIN
|
||||
#undef NAZARA_AUDIO_AL_EXT_END
|
||||
#undef NAZARA_AUDIO_ALC_EXT_FUNCTION
|
||||
#undef NAZARA_AUDIO_ALC_EXT_BEGIN
|
||||
#undef NAZARA_AUDIO_ALC_EXT_END
|
||||
#undef NAZARA_AUDIO_ALC_FUNCTION
|
||||
|
||||
Reference in New Issue
Block a user