Attempt more accurate frame timing (windows). Increase audio volume.

This commit is contained in:
Henrik Rydgard 2012-12-18 10:25:57 +01:00
parent b6ebe427ac
commit 2b8419e0ff
2 changed files with 12 additions and 6 deletions

View file

@ -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();

View file

@ -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;