aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-13 21:18:18 -0800
committerChris Robinson <[email protected]>2017-02-13 21:18:18 -0800
commit0d19a209014582f1e77ab3b927dfb1af6c307d66 (patch)
tree38d5b06d2003a23175522411bfeeffb8fc252f7a /OpenAL32/Include
parent0324712540f88d18f1fa8f18f7a72da06af00d75 (diff)
Make the source state atomic
Since it's modified by the mixer when playback is ended, a plain struct member isn't safe.
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alSource.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 3111a48a..b9479905 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -175,7 +175,7 @@ typedef struct ALsource {
ALint SourceType;
/** Source state (initial, playing, paused, or stopped) */
- ALenum state;
+ ATOMIC(ALenum) state;
ALenum new_state;
/** Source Buffer Queue info. */
@@ -224,6 +224,13 @@ void UpdateAllSourceProps(ALCcontext *context);
ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
ALboolean ApplyOffset(ALsource *Source);
+inline ALboolean IsPlayingOrPaused(ALsource *source)
+{
+ ALenum state = ATOMIC_LOAD_SEQ(&source->state);
+ return state == AL_PLAYING || state == AL_PAUSED;
+}
+
+
ALvoid ReleaseALSources(ALCcontext *Context);
#ifdef __cplusplus