diff options
-rw-r--r-- | Alc/ALc.c | 45 | ||||
-rw-r--r-- | Alc/backends/base.h | 12 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 11 |
4 files changed, 64 insertions, 8 deletions
@@ -153,6 +153,18 @@ static ALint64 BackendWrapper_getLatency(BackendWrapper *self) return device->Funcs->GetLatency(device); } +static void BackendWrapper_lock(BackendWrapper *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + return device->Funcs->Lock(device); +} + +static void BackendWrapper_unlock(BackendWrapper *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + return device->Funcs->Unlock(device); +} + static void BackendWrapper_Delete(BackendWrapper *self) { free(self); @@ -1414,11 +1426,44 @@ ALint64 ALCdevice_GetLatencyDefault(ALCdevice *UNUSED(device)) return 0; } + ALint64 alcGetLatency(ALCdevice *device) { return VCALL0(device->Backend,getLatency,()); } +void ALCdevice_Lock(ALCdevice *device) +{ + return VCALL0(device->Backend,lock,()); +} + +void ALCdevice_Unlock(ALCdevice *device) +{ + return VCALL0(device->Backend,unlock,()); +} + +void LockContext(ALCcontext *context) +{ + VCALL0(context->Device->Backend,lock,()); +} + +void UnlockContext(ALCcontext *context) +{ + VCALL0(context->Device->Backend,unlock,()); +} + + +void ALCbackend_lock(ALCbackend *self) +{ + ALCdevice_LockDefault(self->mDevice); +} + +void ALCbackend_unlock(ALCbackend *self) +{ + ALCdevice_UnlockDefault(self->mDevice); +} + + /* SetDefaultWFXChannelOrder * * Sets the default channel order used by WaveFormatEx. diff --git a/Alc/backends/base.h b/Alc/backends/base.h index 9cc0d66b..ed690f56 100644 --- a/Alc/backends/base.h +++ b/Alc/backends/base.h @@ -12,6 +12,9 @@ typedef struct ALCbackend { ALCdevice *mDevice; } ALCbackend; +void ALCbackend_lock(ALCbackend *self); +void ALCbackend_unlock(ALCbackend *self); + struct ALCbackendVtable { void (*const Destruct)(ALCbackend *state); @@ -24,6 +27,9 @@ struct ALCbackendVtable { ALint64 (*getLatency)(ALCbackend*); + void (*lock)(ALCbackend*); + void (*unlock)(ALCbackend*); + void (*const Delete)(ALCbackend *state); }; @@ -42,6 +48,10 @@ static void T##_ALCbackend_stop(ALCbackend *obj) \ { T##_stop(STATIC_UPCAST(T, ALCbackend, obj)); } \ static ALint64 T##_ALCbackend_getLatency(ALCbackend *obj) \ { return T##_getLatency(STATIC_UPCAST(T, ALCbackend, obj)); } \ +static void T##_ALCbackend_lock(ALCbackend *obj) \ +{ T##_lock(STATIC_UPCAST(T, ALCbackend, obj)); } \ +static void T##_ALCbackend_unlock(ALCbackend *obj) \ +{ T##_unlock(STATIC_UPCAST(T, ALCbackend, obj)); } \ static void T##_ALCbackend_Delete(ALCbackend *obj) \ { T##_Delete(STATIC_UPCAST(T, ALCbackend, obj)); } \ \ @@ -54,6 +64,8 @@ static const struct ALCbackendVtable T##_ALCbackend_vtable = { \ T##_ALCbackend_start, \ T##_ALCbackend_stop, \ T##_ALCbackend_getLatency, \ + T##_ALCbackend_lock, \ + T##_ALCbackend_unlock, \ \ T##_ALCbackend_Delete, \ } diff --git a/CMakeLists.txt b/CMakeLists.txt index 3346b0e5..c056a7d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ ENDIF() # Add definitions, compiler switches, etc. INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}") IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include") + INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") IF(WIN32 AND ALSOFT_NO_UID_DEFS) ADD_DEFINITIONS("-DAL_NO_UID_DEFS") ENDIF() @@ -837,7 +837,7 @@ SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBR IF(WIN32 AND ALSOFT_NO_UID_DEFS) SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include") +SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VERSION}) IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 29e01034..01a2ec37 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -683,8 +683,6 @@ struct ALCdevice_struct #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a))) #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c))) #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a))) -#define ALCdevice_Lock(a) ((a)->Funcs->Lock((a))) -#define ALCdevice_Unlock(a) ((a)->Funcs->Unlock((a))) // Frequency was requested by the app or config file #define DEVICE_FREQUENCY_REQUEST (1<<1) @@ -786,16 +784,17 @@ void ALCdevice_LockDefault(ALCdevice *device); void ALCdevice_UnlockDefault(ALCdevice *device); ALint64 ALCdevice_GetLatencyDefault(ALCdevice *device); -static inline void LockContext(ALCcontext *context) -{ ALCdevice_Lock(context->Device); } -static inline void UnlockContext(ALCcontext *context) -{ ALCdevice_Unlock(context->Device); } +void ALCdevice_Lock(ALCdevice *device); +void ALCdevice_Unlock(ALCdevice *device); +void LockContext(ALCcontext *context); +void UnlockContext(ALCcontext *context); void *al_malloc(size_t alignment, size_t size); void *al_calloc(size_t alignment, size_t size); void al_free(void *ptr); + typedef struct { #ifdef HAVE_FENV_H DERIVE_FROM_TYPE(fenv_t); |