Defer source offset changes requested by the app
This commit is contained in:
parent
a97211b572
commit
858592832f
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user