diff options
author | Colin Snover | 2017-09-05 20:56:19 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-12 11:35:50 -0500 |
commit | fa52df018ef44a30b45ceed31dffc25de3393e84 (patch) | |
tree | 5995cf19956c28676d1e619157eeac5e3555559b /backends/mixer/doublebuffersdl | |
parent | 4a75fbab1b508f4240615c62811e2c8828534177 (diff) | |
download | scummvm-rg350-fa52df018ef44a30b45ceed31dffc25de3393e84.tar.gz scummvm-rg350-fa52df018ef44a30b45ceed31dffc25de3393e84.tar.bz2 scummvm-rg350-fa52df018ef44a30b45ceed31dffc25de3393e84.zip |
SDL: Fix DoubleBufferSDLMixerManager doubling audio latency
If it turns out that everything that had previously been fixed by
this manager is broken by this change, everything that had been
fixed probably could have been fixed by just increasing the audio
buffer size in SdlMixerManager. :\
Diffstat (limited to 'backends/mixer/doublebuffersdl')
-rw-r--r-- | backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp | 7 | ||||
-rw-r--r-- | backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp index e5f63dc908..ea0ba024bc 100644 --- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp +++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp @@ -62,6 +62,13 @@ void DoubleBufferSDLMixerManager::startAudio() { SdlMixerManager::startAudio(); } +SDL_AudioSpec DoubleBufferSDLMixerManager::getAudioSpec(uint32 rate) { + SDL_AudioSpec desired = SdlMixerManager::getAudioSpec(rate); + // Don't double audio latency when double buffering + desired.samples /= 2; + return desired; +} + void DoubleBufferSDLMixerManager::mixerProducerThread() { byte nextSoundBuffer; diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h index e3019fe11b..e952cd2100 100644 --- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h +++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h @@ -44,6 +44,8 @@ protected: uint _soundBufSize; byte *_soundBuffers[2]; + virtual SDL_AudioSpec getAudioSpec(uint32 rate) override; + /** * Handles and swap the sound buffers */ |