aboutsummaryrefslogtreecommitdiff
path: root/shell/emu/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/emu/core.c')
-rw-r--r--shell/emu/core.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/shell/emu/core.c b/shell/emu/core.c
index e20e43d..d4ff19d 100644
--- a/shell/emu/core.c
+++ b/shell/emu/core.c
@@ -274,6 +274,11 @@ static const uint32_t TblSkip[4][4] = {
};
#endif
+#ifdef AUDIO_FRAMESKIP
+#define MAX_SKIP_COUNT 3
+static uint32_t SkipCnt = 0;
+#endif
+
void Emulation_Run (void)
{
#ifndef USE_BLARGG_APU
@@ -294,6 +299,21 @@ void Emulation_Run (void)
#endif
Settings.HardDisableAudio = false;
+#ifdef AUDIO_FRAMESKIP
+ if (IPPU.RenderThisFrame) {
+ if (Audio_Underrun_Likely()) {
+ if (SkipCnt < MAX_SKIP_COUNT) {
+ SkipCnt++;
+ IPPU.RenderThisFrame = false;
+ } else {
+ SkipCnt = 0;
+ }
+ }
+ } else {
+ SkipCnt = 0;
+ }
+#endif
+
S9xMainLoop();
#ifndef USE_BLARGG_APU
@@ -310,12 +330,12 @@ void Emulation_Run (void)
#endif
-#ifdef FRAMESKIP
+#if defined(FRAMESKIP) || defined(AUDIO_FRAMESKIP)
if (IPPU.RenderThisFrame)
{
#endif
Update_Video_Ingame();
-#ifdef FRAMESKIP
+#if defined(FRAMESKIP) || defined(AUDIO_FRAMESKIP)
IPPU.RenderThisFrame = false;
}
else