diff options
author | Chris Robinson <[email protected]> | 2017-02-27 15:35:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-27 15:35:15 -0800 |
commit | 5c859af24ea44dabbbb31631309bb08a858a523e (patch) | |
tree | 5713cdb318c1d9869e4b2e24d0f415ec0c89fd71 /Alc/ALc.c | |
parent | 513c18fdc4d0d9184e061570209eb59f4ad0e392 (diff) |
Move the current buffer queue entry and play position to the voice
This has a couple behavioral changes. First and biggest is that querying
AL_BUFFERS_PROCESSED from a source will always return all buffers processed
when in an AL_STOPPED state. Previously all buffers would be set as processed
when first becoming stopped, but newly queued buffers would *not* be indicated
as processed. That old behavior was not compliant with the spec, which
unequivocally states "On a source in the AL_STOPPED state, all buffers are
processed."
Secondly, querying AL_BUFFER on an AL_STREAMING source will now always return
0. Previously it would return the current "active" buffer in the queue, but
there's no basis for that in the spec.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -1692,22 +1692,24 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) LockUIntMapRead(&context->SourceMap); V0(device->Backend,lock)(); - for(pos = 0;pos < context->SourceMap.size;pos++) + for(pos = 0;pos < context->VoiceCount;pos++) { - ALsource *Source = context->SourceMap.values[pos]; - ALenum new_state; - - if(Source->OffsetType != AL_NONE && IsPlayingOrPaused(Source)) + ALvoice *voice = context->Voices[pos]; + ALsource *source = voice->Source; + if(source && source->OffsetType != AL_NONE) { - WriteLock(&Source->queue_lock); - ApplyOffset(Source); - WriteUnlock(&Source->queue_lock); + WriteLock(&source->queue_lock); + ApplyOffset(source, voice); + WriteUnlock(&source->queue_lock); } - - new_state = Source->new_state; - Source->new_state = AL_NONE; + } + for(pos = 0;pos < context->SourceMap.size;pos++) + { + ALsource *source = context->SourceMap.values[pos]; + ALenum new_state = source->new_state; + source->new_state = AL_NONE; if(new_state) - SetSourceState(Source, context, new_state); + SetSourceState(source, context, new_state); } V0(device->Backend,unlock)(); UnlockUIntMapRead(&context->SourceMap); |