summaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h2
-rw-r--r--OpenAL32/alSource.c9
-rw-r--r--OpenAL32/alState.c11
3 files changed, 14 insertions, 8 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 87d04eb8..672b26b2 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -131,6 +131,8 @@ typedef struct ALsource
#define ALsource_Update(s,a) ((s)->Update(s,a))
ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
+ALboolean ApplyOffset(ALsource *Source);
+
ALvoid ReleaseALSources(ALCcontext *Context);
#ifdef __cplusplus
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 8fea0f91..532d5178 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -48,7 +48,6 @@ const ALsizei ResamplerPrePadding[RESAMPLER_MAX] = {
static ALvoid InitSourceParams(ALsource *Source);
static ALvoid GetSourceOffset(ALsource *Source, ALenum eName, ALdouble *Offsets, ALdouble updateLen);
-static ALboolean ApplyOffset(ALsource *Source);
static ALint GetByteOffset(ALsource *Source);
#define LookupSource(m, k) ((ALsource*)LookupUIntMapKey(&(m), (k)))
@@ -368,7 +367,8 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum eParam, ALfloat flValu
else
Source->lOffset = (ALint)flValue;
- if ((Source->state == AL_PLAYING) || (Source->state == AL_PAUSED))
+ if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
+ !pContext->DeferUpdates)
{
if(ApplyOffset(Source) == AL_FALSE)
alSetError(pContext, AL_INVALID_VALUE);
@@ -636,7 +636,8 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
else
Source->lOffset = lValue;
- if(Source->state == AL_PLAYING || Source->state == AL_PAUSED)
+ if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
+ !pContext->DeferUpdates)
{
if(ApplyOffset(Source) == AL_FALSE)
alSetError(pContext, AL_INVALID_VALUE);
@@ -2016,7 +2017,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A
Apply a playback offset to the Source. This function will update the queue (to correctly
mark buffers as 'pending' or 'processed' depending upon the new offset.
*/
-static ALboolean ApplyOffset(ALsource *Source)
+ALboolean ApplyOffset(ALsource *Source)
{
const ALbufferlistitem *BufferList;
const ALbuffer *Buffer;
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index bb500bf5..38952100 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -599,13 +599,16 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
for(pos = 0;pos < Context->SourceMap.size;pos++)
{
- ALsource *src = Context->SourceMap.array[pos].value;
+ ALsource *Source = Context->SourceMap.array[pos].value;
ALenum new_state;
- new_state = src->new_state;
- src->new_state = AL_NONE;
+ if(Source->lOffset != -1)
+ ApplyOffset(Source);
+
+ new_state = Source->new_state;
+ Source->new_state = AL_NONE;
if(new_state)
- SetSourceState(src, Context, new_state);
+ SetSourceState(Source, Context, new_state);
}
}