System: Reset throttler when audio buffers underflow

Should hopefully reduce the chances of the audio source ending up out of
phase from the emulation when vsync is disabled.
This commit is contained in:
Connor McLaughlin
2020-12-07 02:43:46 +10:00
parent c8f33e340b
commit b44a654943
4 changed files with 28 additions and 4 deletions

View File

@ -170,12 +170,14 @@ void AudioStream::ReadFrames(SampleType* samples, u32 num_frames, bool apply_vol
}
Log_DevPrintf("Audio buffer underflow, resampled %u frames to %u", samples_copied / m_channels, num_frames);
m_underflow_flag.store(true);
}
else
{
// read nothing, so zero-fill
std::memset(samples, 0, sizeof(SampleType) * total_samples);
Log_DevPrintf("Audio buffer underflow with no samples, added %u frames silence", num_frames);
m_underflow_flag.store(true);
}
}
@ -218,4 +220,5 @@ void AudioStream::EmptyBuffers()
{
std::unique_lock<std::mutex> lock(m_buffer_mutex);
m_buffer.Clear();
m_underflow_flag.store(false);
}