diff options
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 749f2ec4..fc5d309b 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -40,6 +40,10 @@ #include "almalloc.h" +extern inline void LockSourcesRead(ALCcontext *context); +extern inline void UnlockSourcesRead(ALCcontext *context); +extern inline void LockSourcesWrite(ALCcontext *context); +extern inline void UnlockSourcesWrite(ALCcontext *context); extern inline struct ALsource *LookupSource(ALCcontext *context, ALuint id); extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id); @@ -1509,6 +1513,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; + LockSourcesWrite(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); @@ -1560,6 +1565,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) } done: + UnlockSourcesWrite(context); ALCcontext_DecRef(context); } @@ -1572,7 +1578,9 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) context = GetContextRef(); if(!context) return AL_FALSE; + LockSourcesRead(context); ret = (LookupSource(context, source) ? AL_TRUE : AL_FALSE); + UnlockSourcesRead(context); ALCcontext_DecRef(context); @@ -1588,12 +1596,14 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(FloatValsByProp(param) == 1)) alSetError(Context, AL_INVALID_ENUM); else SetSourcefv(Source, Context, param, &value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1606,6 +1616,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(FloatValsByProp(param) == 3)) @@ -1615,6 +1626,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 ALfloat fvals[3] = { value1, value2, value3 }; SetSourcefv(Source, Context, param, fvals); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1627,6 +1639,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1635,6 +1648,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat alSetError(Context, AL_INVALID_ENUM); else SetSourcefv(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1648,6 +1662,7 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(DoubleValsByProp(param) == 1)) @@ -1657,6 +1672,7 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va ALfloat fval = (ALfloat)value; SetSourcefv(Source, Context, param, &fval); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1669,6 +1685,7 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(DoubleValsByProp(param) == 3)) @@ -1678,6 +1695,7 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v ALfloat fvals[3] = { (ALfloat)value1, (ALfloat)value2, (ALfloat)value3 }; SetSourcefv(Source, Context, param, fvals); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1691,6 +1709,7 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1706,6 +1725,7 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo fvals[i] = (ALfloat)values[i]; SetSourcefv(Source, Context, param, fvals); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1719,12 +1739,14 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(IntValsByProp(param) == 1)) alSetError(Context, AL_INVALID_ENUM); else SetSourceiv(Source, Context, param, &value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1737,6 +1759,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(IntValsByProp(param) == 3)) @@ -1746,6 +1769,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL ALint ivals[3] = { value1, value2, value3 }; SetSourceiv(Source, Context, param, ivals); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1758,6 +1782,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1766,6 +1791,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val alSetError(Context, AL_INVALID_ENUM); else SetSourceiv(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1779,12 +1805,14 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(Int64ValsByProp(param) == 1)) alSetError(Context, AL_INVALID_ENUM); else SetSourcei64v(Source, Context, param, &value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1797,6 +1825,7 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(Int64ValsByProp(param) == 3)) @@ -1806,6 +1835,7 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF ALint64SOFT i64vals[3] = { value1, value2, value3 }; SetSourcei64v(Source, Context, param, i64vals); } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1818,6 +1848,7 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1826,6 +1857,7 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin alSetError(Context, AL_INVALID_ENUM); else SetSourcei64v(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1839,6 +1871,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!value) @@ -1851,6 +1884,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val if(GetSourcedv(Source, Context, param, &dval)) *value = (ALfloat)dval; } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1864,6 +1898,7 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(value1 && value2 && value3)) @@ -1880,6 +1915,7 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va *value3 = (ALfloat)dvals[2]; } } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1894,6 +1930,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1910,6 +1947,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va values[i] = (ALfloat)dvals[i]; } } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1923,6 +1961,7 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble * Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!value) @@ -1931,6 +1970,7 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble * alSetError(Context, AL_INVALID_ENUM); else GetSourcedv(Source, Context, param, value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1943,6 +1983,7 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(value1 && value2 && value3)) @@ -1959,6 +2000,7 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value3 = dvals[2]; } } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1971,6 +2013,7 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -1979,6 +2022,7 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble alSetError(Context, AL_INVALID_ENUM); else GetSourcedv(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -1992,6 +2036,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!value) @@ -2000,6 +2045,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value alSetError(Context, AL_INVALID_ENUM); else GetSourceiv(Source, Context, param, value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2013,6 +2059,7 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(value1 && value2 && value3)) @@ -2029,6 +2076,7 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 *value3 = ivals[2]; } } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2042,6 +2090,7 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -2050,6 +2099,7 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values alSetError(Context, AL_INVALID_ENUM); else GetSourceiv(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2063,6 +2113,7 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!value) @@ -2071,6 +2122,7 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S alSetError(Context, AL_INVALID_ENUM); else GetSourcei64v(Source, Context, param, value); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2083,6 +2135,7 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!(value1 && value2 && value3)) @@ -2099,6 +2152,7 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 *value3 = i64vals[2]; } } + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2111,6 +2165,7 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; + LockSourcesRead(Context); if((Source=LookupSource(Context, source)) == NULL) alSetError(Context, AL_INVALID_NAME); else if(!values) @@ -2119,6 +2174,7 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64 alSetError(Context, AL_INVALID_ENUM); else GetSourcei64v(Source, Context, param, values); + UnlockSourcesRead(Context); ALCcontext_DecRef(Context); } @@ -2137,6 +2193,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; + LockSourcesRead(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < n;i++) @@ -2174,6 +2231,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) UnlockContext(context); done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } @@ -2190,6 +2248,7 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; + LockSourcesRead(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < n;i++) @@ -2208,6 +2267,7 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) UnlockContext(context); done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } @@ -2224,6 +2284,7 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; + LockSourcesRead(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < n;i++) @@ -2242,6 +2303,7 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) UnlockContext(context); done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } @@ -2258,6 +2320,7 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; + LockSourcesRead(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < n;i++) @@ -2276,6 +2339,7 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) UnlockContext(context); done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } @@ -2298,6 +2362,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu device = context->Device; + LockSourcesRead(context); if(!(nb >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); if((source=LookupSource(context, src)) == NULL) @@ -2413,6 +2478,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu WriteUnlock(&source->queue_lock); done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } @@ -2431,6 +2497,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint context = GetContextRef(); if(!context) return; + LockSourcesRead(context); if(!(nb >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); @@ -2494,6 +2561,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint } done: + UnlockSourcesRead(context); ALCcontext_DecRef(context); } |