diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index e10622fbba..29b3dac45c 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -214,12 +214,18 @@ void hleEnterVblank(u64 userdata, int cyclesLate) if (lastFrameTime == 0.0) lastFrameTime = time_now_d(); if (!GetAsyncKeyState(VK_TAB)) { - while (time_now_d() < lastFrameTime + 1.0 / 60.0f) { + while (time_now_d() < lastFrameTime + 1.0 / 60.0) { Common::SleepCurrentThread(1); time_update(); } - lastFrameTime = time_now_d(); + // Advance lastFrameTime by a constant amount each frame, + // but don't let it get too far behind. + lastFrameTime = std::max(lastFrameTime + 1.0 / 60.0, time_now_d() - 1.5 / 60.0); } + + // We are going to have to do something about audio timing for platforms that + // are vsynced to something that's not exactly 60fps.. + #endif host->BeginFrame(); diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index c9413b3308..b4ad23d2ef 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -250,10 +250,10 @@ void SasInstance::Mix(u32 outAddr) { // We mix into this 32-bit temp buffer and clip in a second loop // Ideally, the shift right should be there too but for now I'm concerned about // not overflowing. - mixBuffer[i * 2] += sample * voice.volumeLeft >> 15; - mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 15; - sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 15; - sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 15; + mixBuffer[i * 2] += sample * voice.volumeLeft >> 12; + mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 12; + sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 12; + sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 12; voice.envelope.Step(); } voice.samplePos += voice.pitch * grainSize;