diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 9c45e23b0d..5e63e3223e 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -116,6 +116,8 @@ unsigned int StereoResampler::MixerFifo::Mix(short* samples, unsigned int numSam m_frac &= 0xffff; } + int realSamples = currentSample; + // Padding with the last value to reduce clicking short s[2]; s[0] = m_buffer[(indexR - 1) & INDEX_MASK]; @@ -132,7 +134,11 @@ unsigned int StereoResampler::MixerFifo::Mix(short* samples, unsigned int numSam // Flush cached variable Common::AtomicStore(m_indexR, indexR); - return numSamples; + if (realSamples != numSamples * 2) { + ILOG("Underrun! %i / %i", realSamples / 2, numSamples); + } + + return realSamples / 2; } unsigned int StereoResampler::Mix(short* samples, unsigned int num_samples, bool consider_framelimit, int sample_rate) { diff --git a/Core/HW/StereoResampler.h b/Core/HW/StereoResampler.h index eeae6bdf4c..7a3a9a3a0b 100644 --- a/Core/HW/StereoResampler.h +++ b/Core/HW/StereoResampler.h @@ -27,7 +27,8 @@ #include "Common/CommonTypes.h" // 16 bit Stereo -#define MAX_SAMPLES (1024 * 2) // 64ms + +#define MAX_SAMPLES (2*(1024 * 2)) // 2*64ms - had to double it for nVidia Shield which has huge buffers #define INDEX_MASK (MAX_SAMPLES * 2 - 1) #define LOW_WATERMARK 1280 // 40 ms diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 3098912dd8..e78f5d7568 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -569,7 +569,7 @@ void NativeInitGraphics() { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); #ifdef _WIN32 - DSound_StartSound(MainWindow::GetHWND(), &Win32Mix, 48000); + DSound_StartSound(MainWindow::GetHWND(), &Win32Mix, 44100); #endif } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index ccd56c00c2..003586d14b 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -187,6 +187,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/HW/MpegDemux.cpp.arm \ $(SRC)/Core/HW/MediaEngine.cpp.arm \ $(SRC)/Core/HW/SasAudio.cpp.arm \ + $(SRC)/Core/HW/StereoResampler.cpp.arm \ $(SRC)/Core/Core.cpp \ $(SRC)/Core/Config.cpp \ $(SRC)/Core/CoreTiming.cpp \ diff --git a/native b/native index 1b5bf730ca..84ed01df53 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 1b5bf730caffa702de34a6db9f0ae93fbbd88eed +Subproject commit 84ed01df53cd557eb126c1f6badef7d9201add5f