From 3ef78ae250b5460bf1b69c4d1f05e27985fa9d1b Mon Sep 17 00:00:00 2001 From: neonloop Date: Fri, 26 Mar 2021 00:29:45 +0000 Subject: Drop buffer size to 8192 --- frontend/main.c | 12 ++++++------ frontend/plat_linux.c | 2 +- frontend/plat_trimui.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'frontend') diff --git a/frontend/main.c b/frontend/main.c index 49f1cb2..f2b4ec3 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -7,6 +7,11 @@ #include "frontend/plat.h" #include "frontend/libpicofe/plat.h" +/* Percentage of free space allowed in the audio buffer before + * skipping frames. Lower numbers mean more skipping but smoother + * audio, since the buffer will stay closer to filled. */ +#define FRAMESKIP_UNDERRUN_THRESHOLD 0.5 + int should_quit = 0; u32 idle_loop_target_pc = 0xFFFFFFFF; @@ -174,7 +179,7 @@ void synchronize(void) case FRAMESKIP_AUTO: skip_next_frame = 0; - if (capacity > 0.5) { + if (capacity > FRAMESKIP_UNDERRUN_THRESHOLD) { skip_next_frame = 1; skipped_frames++; } @@ -193,11 +198,6 @@ void synchronize(void) skipped_frames = 0; } - while (limit_frames && capacity < 0.1) { - plat_sleep_ms(1); - capacity = plat_sound_capacity(); - } - if (show_fps) { ticks = plat_get_ticks_ms(); if (ticks > nextsec) { diff --git a/frontend/plat_linux.c b/frontend/plat_linux.c index 38e28cc..09d9a48 100644 --- a/frontend/plat_linux.c +++ b/frontend/plat_linux.c @@ -11,7 +11,7 @@ static SDL_Surface* screen; -#define BUF_LEN 16384 +#define BUF_LEN 8192 static short buf[BUF_LEN]; static int buf_w, buf_r; diff --git a/frontend/plat_trimui.c b/frontend/plat_trimui.c index 988a433..bdd5a92 100644 --- a/frontend/plat_trimui.c +++ b/frontend/plat_trimui.c @@ -11,7 +11,7 @@ static SDL_Surface* screen; -#define BUF_LEN 16384 +#define BUF_LEN 8192 static short buf[BUF_LEN]; static int buf_w, buf_r; -- cgit v1.2.3