From 94473eda1931e9e121b883eee82e12023fb16a2b Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sat, 31 Aug 2024 20:39:48 +0200 Subject: [PATCH] [APU] Changed default value of apu_max_queued_frames to 8. Added ability to set it even lower to 4. However this might impact CPU usage. --- src/xenia/apu/audio_system.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xenia/apu/audio_system.cc b/src/xenia/apu/audio_system.cc index d29b190ca..b49c8225a 100644 --- a/src/xenia/apu/audio_system.cc +++ b/src/xenia/apu/audio_system.cc @@ -35,9 +35,10 @@ // and let the normal AudioSystem handling take it, to prevent duplicate // implementations. They can be found in xboxkrnl_audio_xma.cc -DEFINE_uint32(apu_max_queued_frames, 64, +DEFINE_uint32(apu_max_queued_frames, 8, "Allows changing max buffered audio frames to reduce audio " - "delay. Minimum is 16.", + "delay. Lowering this value might cause performance issues. " + "Value range: [4-64]", "APU"); namespace xe { @@ -48,7 +49,9 @@ AudioSystem::AudioSystem(cpu::Processor* processor) processor_(processor), worker_running_(false) { std::memset(clients_, 0, sizeof(clients_)); - queued_frames_ = std::max(cvars::apu_max_queued_frames, (uint32_t)16); + queued_frames_ = std::min( + static_cast(kMaximumQueuedFrames), + std::max(cvars::apu_max_queued_frames, static_cast(4))); for (size_t i = 0; i < kMaximumClientCount; ++i) { client_semaphores_[i] = xe::threading::Semaphore::Create(0, queued_frames_);