Skipped timestretching if the emulator is running below 10% speed to prevent buffer overflows.

This commit is contained in:
skidau 2013-01-11 23:06:20 +11:00
parent 3632ce6df5
commit 73140c7da7
2 changed files with 4 additions and 2 deletions

View File

@ -207,7 +207,10 @@ void OpenALStream::SoundLoop()
Core::RequestRefreshInfo();
rate = m_mixer->GetCurrentSpeed();
}
if (rate > 0)
// Place a lower limit of 10% speed. When a game boots up, there will be
// many silence samples. These do not need to be timestretched.
if (rate > 0.10)
{
// Adjust SETTING_SEQUENCE_MS to balance between lag vs hollow audio
soundTouch.setSetting(SETTING_SEQUENCE_MS, (int)(1 / (rate * rate)));

View File

@ -73,7 +73,6 @@ public:
private:
std::thread thread;
Common::Event soundSyncEvent;
Common::Event mainSyncEvent;
short realtimeBuffer[OAL_MAX_SAMPLES * 2];
soundtouch::SAMPLETYPE sampleBuffer[OAL_MAX_SAMPLES * SIZE_FLOAT * SURROUND_CHANNELS * OAL_NUM_BUFFERS];