diff options
author | Chris Robinson <[email protected]> | 2018-01-27 21:16:24 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-27 21:16:24 -0800 |
commit | f16ece6048ebe3e81b892476fa0dc66f4091a4a9 (patch) | |
tree | 4892fb3b275a2164bf07fcf08cfb79888c69ec12 | |
parent | e12059a31186605ce2ed534ba42004edf3df5a6b (diff) |
Move some inline functions into a header instead of copying them
Unfortunately does not include the Lookup* functions, which need the full type
declaration to offset the pointer.
-rw-r--r-- | OpenAL32/Include/alMain.h | 17 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 14 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 11 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 7 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 22 |
5 files changed, 36 insertions, 35 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index d21ec3b0..5b31696e 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -723,10 +723,19 @@ inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan) { return GetChannelIndex(real->ChannelName, chan); } -inline void LockBufferList(ALCdevice *device) -{ almtx_lock(&device->BufferLock); } -inline void UnlockBufferList(ALCdevice *device) -{ almtx_unlock(&device->BufferLock); } +inline void LockBufferList(ALCdevice *device) { almtx_lock(&device->BufferLock); } +inline void UnlockBufferList(ALCdevice *device) { almtx_unlock(&device->BufferLock); } + +inline void LockEffectList(ALCdevice *device) { almtx_lock(&device->EffectLock); } +inline void UnlockEffectList(ALCdevice *device) { almtx_unlock(&device->EffectLock); } + +inline void LockFilterList(ALCdevice *device) { almtx_lock(&device->FilterLock); } +inline void UnlockFilterList(ALCdevice *device) { almtx_unlock(&device->FilterLock); } + +inline void LockEffectSlotList(ALCcontext *context) +{ almtx_lock(&context->EffectSlotLock); } +inline void UnlockEffectSlotList(ALCcontext *context) +{ almtx_unlock(&context->EffectSlotLock); } vector_al_string SearchDataFiles(const char *match, const char *subdir); diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 30ca097f..70025409 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -36,6 +36,9 @@ #include "almalloc.h" +extern inline void LockEffectSlotList(ALCcontext *context); +extern inline void UnlockEffectSlotList(ALCcontext *context); + static UIntMap EffectStateFactoryMap; static inline ALeffectStateFactory *getFactoryByType(ALenum type) { @@ -48,11 +51,6 @@ static inline ALeffectStateFactory *getFactoryByType(ALenum type) static void ALeffectState_IncRef(ALeffectState *state); -static inline void LockEffectSlotList(ALCcontext *context) -{ almtx_lock(&context->EffectSlotLock); } -static inline void UnlockEffectSlotList(ALCcontext *context) -{ almtx_unlock(&context->EffectSlotLock); } - static inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) { id--; @@ -275,15 +273,15 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param case AL_EFFECTSLOT_EFFECT: device = context->Device; - almtx_lock(&device->EffectLock); + LockEffectList(device); effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) { - almtx_unlock(&device->EffectLock); + UnlockEffectList(device); SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid effect ID %u", value); } err = InitializeEffect(context, slot, effect); - almtx_unlock(&device->EffectLock); + UnlockEffectList(device); if(err != AL_NO_ERROR) SETERR_GOTO(context, err, done, "Effect initialization failed"); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 0fa2ee08..e538433f 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -32,6 +32,10 @@ #include "alError.h" +extern inline void LockEffectList(ALCdevice *device); +extern inline void UnlockEffectList(ALCdevice *device); +extern inline ALboolean IsReverbEffect(ALenum type); + const struct EffectList EffectList[EFFECTLIST_SIZE] = { { "eaxreverb", EAXREVERB_EFFECT, AL_EFFECT_EAXREVERB }, { "reverb", REVERB_EFFECT, AL_EFFECT_REVERB }, @@ -48,17 +52,10 @@ const struct EffectList EffectList[EFFECTLIST_SIZE] = { ALboolean DisabledEffects[MAX_EFFECTS]; -extern inline ALboolean IsReverbEffect(ALenum type); - static ALeffect *AllocEffect(ALCcontext *context); static void FreeEffect(ALCdevice *device, ALeffect *effect); static void InitEffectParams(ALeffect *effect, ALenum type); -static inline void LockEffectList(ALCdevice *device) -{ almtx_lock(&device->EffectLock); } -static inline void UnlockEffectList(ALCdevice *device) -{ almtx_unlock(&device->EffectLock); } - static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) { EffectSubList *sublist; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 7a3513c3..de527fea 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -29,6 +29,8 @@ #include "alError.h" +extern inline void LockFilterList(ALCdevice *device); +extern inline void UnlockFilterList(ALCdevice *device); extern inline void ALfilterState_clear(ALfilterState *filter); extern inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilterState *restrict src); extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples); @@ -39,11 +41,6 @@ static ALfilter *AllocFilter(ALCcontext *context); static void FreeFilter(ALCdevice *device, ALfilter *filter); static void InitFilterParams(ALfilter *filter, ALenum type); -static inline void LockFilterList(ALCdevice *device) -{ almtx_lock(&device->FilterLock); } -static inline void UnlockFilterList(ALCdevice *device) -{ almtx_unlock(&device->FilterLock); } - static inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) { FilterSubList *sublist; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 19017e51..b3e98bc9 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -908,10 +908,10 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_DIRECT_FILTER: - almtx_lock(&device->FilterLock); + LockFilterList(device); if(!(*values == 0 || (filter=LookupFilter(device, *values)) != NULL)) { - almtx_unlock(&device->FilterLock); + UnlockFilterList(device); SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", *values); } @@ -932,7 +932,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Direct.GainLF = filter->GainLF; Source->Direct.LFReference = filter->LFReference; } - almtx_unlock(&device->FilterLock); + UnlockFilterList(device); DO_UPDATEPROPS(); return AL_TRUE; @@ -994,23 +994,23 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AUXILIARY_SEND_FILTER: - almtx_lock(&Context->EffectSlotLock); + LockEffectSlotList(Context); if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL)) { - almtx_unlock(&Context->EffectSlotLock); + UnlockEffectSlotList(Context); SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u", values[0]); } if(!((ALuint)values[1] < (ALuint)device->NumAuxSends)) { - almtx_unlock(&Context->EffectSlotLock); + UnlockEffectSlotList(Context); SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid send %u", values[1]); } - almtx_lock(&device->FilterLock); + LockFilterList(device); if(!(values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL)) { - almtx_unlock(&device->FilterLock); - almtx_unlock(&Context->EffectSlotLock); + UnlockFilterList(device); + UnlockEffectSlotList(Context); SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", values[2]); } @@ -1032,7 +1032,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].GainLF = filter->GainLF; Source->Send[values[1]].LFReference = filter->LFReference; } - almtx_unlock(&device->FilterLock); + UnlockFilterList(device); if(slot != Source->Send[values[1]].Slot && IsPlayingOrPaused(Source)) { @@ -1059,7 +1059,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].Slot = slot; DO_UPDATEPROPS(); } - almtx_unlock(&Context->EffectSlotLock); + UnlockEffectSlotList(Context); return AL_TRUE; |