diff options
author | Chris Robinson <[email protected]> | 2019-05-05 01:51:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-05-05 01:51:46 -0700 |
commit | 8d437a513539d016764e3297a441a318d7e7997c (patch) | |
tree | 6b1d8eab4d41bd3ea02d992d2255c0f1e99d88cf /Alc/mixvoice.cpp | |
parent | 0759ed721341cff00ddb3d8c40848cd20065500c (diff) |
Use available buffer samples when pausing a source
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r-- | Alc/mixvoice.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index e2e0a1e6..293de0b5 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -555,7 +555,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc std::fill(srciter, std::end(SrcData), 0.0f); auto srcdata_end = std::begin(SrcData) + SrcBufferSize; - if(vstate != ALvoice::Playing) + if(!BufferListItem) srciter = std::copy(voice->mPrevSamples[chan].begin()+MAX_RESAMPLE_PADDING, voice->mPrevSamples[chan].end(), srciter); else if(isstatic) @@ -787,9 +787,9 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc OutPos += DstBufferSize; Counter = maxi(DstBufferSize, Counter) - DstBufferSize; - if(UNLIKELY(vstate != ALvoice::Playing)) + if(UNLIKELY(!BufferListItem)) { - /* Do nothing extra for fading out. */ + /* Do nothing extra when there's no buffers. */ } else if(isstatic) { @@ -810,7 +810,8 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc /* Handle non-looping static source */ if(DataPosInt >= BufferListItem->max_samples) { - vstate = ALvoice::Stopped; + if(LIKELY(vstate == ALvoice::Playing)) + vstate = ALvoice::Stopped; BufferListItem = nullptr; break; } @@ -828,7 +829,8 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc BufferListItem = BufferListItem->next.load(std::memory_order_relaxed); if(!BufferListItem && !(BufferListItem=BufferLoopItem)) { - vstate = ALvoice::Stopped; + if(LIKELY(vstate == ALvoice::Playing)) + vstate = ALvoice::Stopped; break; } } |