Try to fix audio delay regression caused when fixing -refreshspeed for

-sound xaudio2
This commit is contained in:
Antonio Giner 2016-08-14 23:55:45 +02:00
parent 92858ce2c4
commit 9f21eabe21

View File

@ -596,6 +596,10 @@ void sound_xaudio2::submit_needed()
XAUDIO2_VOICE_STATE state;
m_sourceVoice->GetState(&state, XAUDIO2_VOICE_NOSAMPLESPLAYED);
// If we have a too many buffers on the queue, flush to resync
if (state.BuffersQueued > 2)
m_sourceVoice->FlushSourceBuffers();
std::lock_guard<std::mutex> lock(m_buffer_lock);
// Roll the buffer