aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-03-19 13:48:40 -0700
committerChris Robinson <[email protected]>2017-03-19 13:48:40 -0700
commitecfa1dcb6ffb79c74c0f6629f395c7619a6a3add (patch)
tree5aa279362017e7219580e0587ae0b051dad9c21b /OpenAL32
parent9e1aa50518e0abc6e8cfe811cedab32bb80a0fc5 (diff)
Don't defer source state or offset changes
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h8
-rw-r--r--OpenAL32/Include/alSource.h4
-rw-r--r--OpenAL32/alSource.c48
-rw-r--r--OpenAL32/alState.c12
4 files changed, 19 insertions, 53 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index ac89adf8..2182d3f0 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -879,15 +879,9 @@ void AppendCaptureDeviceList(const ALCchar *name);
void ALCdevice_Lock(ALCdevice *device);
void ALCdevice_Unlock(ALCdevice *device);
-void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type);
+void ALCcontext_DeferUpdates(ALCcontext *context);
void ALCcontext_ProcessUpdates(ALCcontext *context);
-enum {
- DeferOff = AL_FALSE,
- DeferAll,
- DeferAllowPlay
-};
-
typedef struct {
#ifdef HAVE_FENV_H
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 1dd835c4..284d5cbe 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -142,7 +142,6 @@ typedef struct ALsource {
/** Source state (initial, playing, paused, or stopped) */
ATOMIC(ALenum) state;
- ALenum new_state;
/** Source Buffer Queue head. */
RWLock queue_lock;
@@ -174,9 +173,6 @@ inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
{ return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); }
void UpdateAllSourceProps(ALCcontext *context);
-ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
-ALboolean ApplyOffset(ALsource *Source, ALvoice *voice);
-
ALvoid ReleaseALSources(ALCcontext *Context);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index c4cdf16e..540821eb 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -54,6 +54,8 @@ static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALui
static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime);
static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context);
static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac);
+static void SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
+static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice);
typedef enum SourceProp {
srcPitch = AL_PITCH,
@@ -543,7 +545,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
Source->OffsetType = prop;
Source->Offset = *values;
- if(SourceShouldUpdate(Source, Context))
+ if(IsPlayingOrPaused(Source))
{
ALvoice *voice;
@@ -749,7 +751,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
Source->OffsetType = prop;
Source->Offset = *values;
- if(SourceShouldUpdate(Source, Context))
+ if(IsPlayingOrPaused(Source))
{
ALvoice *voice;
@@ -2354,7 +2356,6 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
{
source = LookupSource(context, sources[i]);
ATOMIC_STORE(&source->state, AL_STOPPED, almemory_order_relaxed);
- source->new_state = AL_NONE;
}
ALCdevice_Unlock(device);
goto done;
@@ -2371,21 +2372,10 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
AllocateVoices(context, newcount, device->NumAuxSends);
}
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
- {
- for(i = 0;i < n;i++)
- {
- source = LookupSource(context, sources[i]);
- source->new_state = AL_PLAYING;
- }
- }
- else
+ for(i = 0;i < n;i++)
{
- for(i = 0;i < n;i++)
- {
- source = LookupSource(context, sources[i]);
- SetSourceState(source, context, AL_PLAYING);
- }
+ source = LookupSource(context, sources[i]);
+ SetSourceState(source, context, AL_PLAYING);
}
ALCdevice_Unlock(device);
@@ -2417,21 +2407,10 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
}
ALCdevice_Lock(context->Device);
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
- {
- for(i = 0;i < n;i++)
- {
- source = LookupSource(context, sources[i]);
- source->new_state = AL_PAUSED;
- }
- }
- else
+ for(i = 0;i < n;i++)
{
- for(i = 0;i < n;i++)
- {
- source = LookupSource(context, sources[i]);
- SetSourceState(source, context, AL_PAUSED);
- }
+ source = LookupSource(context, sources[i]);
+ SetSourceState(source, context, AL_PAUSED);
}
ALCdevice_Unlock(context->Device);
@@ -2466,7 +2445,6 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
for(i = 0;i < n;i++)
{
source = LookupSource(context, sources[i]);
- source->new_state = AL_NONE;
SetSourceState(source, context, AL_STOPPED);
}
ALCdevice_Unlock(context->Device);
@@ -2502,7 +2480,6 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
for(i = 0;i < n;i++)
{
source = LookupSource(context, sources[i]);
- source->new_state = AL_NONE;
SetSourceState(source, context, AL_INITIAL);
}
ALCdevice_Unlock(context->Device);
@@ -2810,7 +2787,6 @@ static void InitSourceParams(ALsource *Source, ALsizei num_sends)
Source->OffsetType = AL_NONE;
Source->SourceType = AL_UNDETERMINED;
ATOMIC_INIT(&Source->state, AL_INITIAL);
- Source->new_state = AL_NONE;
ATOMIC_INIT(&Source->queue, NULL);
@@ -2979,7 +2955,7 @@ void UpdateAllSourceProps(ALCcontext *context)
*
* Sets the source's new play state given its current state.
*/
-ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
+static void SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
{
ALCdevice *device = Context->Device;
ALvoice *voice;
@@ -3372,7 +3348,7 @@ static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *conte
* Apply the stored playback offset to the Source. This function will update
* the number of buffers "played" given the stored offset.
*/
-ALboolean ApplyOffset(ALsource *Source, ALvoice *voice)
+static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice)
{
ALbufferlistitem *BufferList;
const ALbuffer *Buffer;
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index e633a86b..eddd2999 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -152,7 +152,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
break;
case AL_DEFERRED_UPDATES_SOFT:
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
+ if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
value = AL_TRUE;
break;
@@ -198,7 +198,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
break;
case AL_DEFERRED_UPDATES_SOFT:
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
+ if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
value = (ALdouble)AL_TRUE;
break;
@@ -243,7 +243,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
break;
case AL_DEFERRED_UPDATES_SOFT:
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
+ if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
value = (ALfloat)AL_TRUE;
break;
@@ -288,7 +288,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
break;
case AL_DEFERRED_UPDATES_SOFT:
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
+ if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
value = (ALint)AL_TRUE;
break;
@@ -333,7 +333,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
break;
case AL_DEFERRED_UPDATES_SOFT:
- if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
+ if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
value = (ALint64SOFT)AL_TRUE;
break;
@@ -671,7 +671,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
context = GetContextRef();
if(!context) return;
- ALCcontext_DeferUpdates(context, DeferAll);
+ ALCcontext_DeferUpdates(context);
ALCcontext_DecRef(context);
}