diff options
-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 */ |