From d4f6cfc816ff2cfd6df14c4a8126a3843fc50915 Mon Sep 17 00:00:00 2001 From: bagnz0r Date: Sun, 7 Jul 2013 00:06:30 +0200 Subject: [PATCH] Added ifdef for low latency audio. --- Core/HLE/__sceAudio.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index bdf4c3614e..7a36d8a3d4 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -29,6 +29,8 @@ #include "FixedSizeQueue.h" #include "Common/Thread.h" +#define LOW_LATENCY_AUDIO true + // Should be used to lock anything related to the outAudioQueue. recursive_mutex section; @@ -37,15 +39,27 @@ int eventHostAudioUpdate = -1; int mixFrequency = 44100; const int hwSampleRate = 44100; + +#ifdef LOW_LATENCY_AUDIO const int hwBlockSize = 16; const int hostAttemptBlockSize = 256; +#else +const int hwBlockSize = 64; +const int hostAttemptBlockSize = 512; +#endif; + const int audioIntervalUs = (int)(1000000ULL * hwBlockSize / hwSampleRate); const int audioHostIntervalUs = (int)(1000000ULL * hostAttemptBlockSize / hwSampleRate); // High and low watermarks, basically. For perfect emulation, the correct values are 0 and 1, respectively. // TODO: Tweak +#ifdef LOW_LATENCY_AUDIO const int chanQueueMaxSizeFactor = 0; const int chanQueueMinSizeFactor = 1; +#else +const int chanQueueMaxSizeFactor = 2; +const int chanQueueMinSizeFactor = 1; +#endif // TODO: Need to replace this with something lockless. Mutexes in the audio pipeline // is bad mojo.