aboutsummaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorneonloop2022-03-27 16:33:44 +0000
committerneonloop2022-03-27 16:33:44 +0000
commit8870de89ba1ad9ae08e5f4c7602007b05fab5f3e (patch)
tree21447aa0ef726eb04317cdd9f0d9481fcb69f297 /menu.c
parentcaa956d120b34e4c0deadb9e61af509a88debd09 (diff)
downloadpicoarch-8870de89ba1ad9ae08e5f4c7602007b05fab5f3e.tar.gz
picoarch-8870de89ba1ad9ae08e5f4c7602007b05fab5f3e.tar.bz2
picoarch-8870de89ba1ad9ae08e5f4c7602007b05fab5f3e.zip
Adds dynamic audio rate control option
When DRC is on, game syncs to frame rate instead of audio buffer capacity. Audio is resampled to generate more samples when buffer is low and less when buffer is high, to keep buffer 40%-60% full. Buffer size doubled to keep same avg. audio latency value. Audio can distort when buffer is out of range, not often during gameplay. Better resampler could improve but would be slower. When buffer is always out of range (heavy frameskip), it is better to leave off, DRC doesn't help anyway then. Idea from RetroArch audio_driver.c and https://near.sh/articles/audio/dynamic-rate-control
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/menu.c b/menu.c
index 52a05fe..2926a86 100644
--- a/menu.c
+++ b/menu.c
@@ -484,6 +484,7 @@ static const char h_restore_def[] = "Switches back to default settings";
static const char h_show_fps[] = "Shows frames and vsyncs per second";
static const char h_show_cpu[] = "Shows CPU usage";
+static const char h_enable_drc[] = "Dynamically adjusts audio rate for smoother video";
static const char h_audio_buffer_size[] =
"The size of the audio buffer, in frames. Higher\n"
@@ -511,6 +512,7 @@ static menu_entry e_menu_video_options[] =
mee_enum_h ("Screen size", 0, scale_size, men_scale_size, h_scale_size),
mee_enum_h ("Filter", 0, scale_filter, men_scale_filter, h_scale_filter),
mee_range_h ("Audio buffer", 0, audio_buffer_size, 1, 15, h_audio_buffer_size),
+ mee_onoff_h ("Audio adjustment", 0, enable_drc, 1, h_enable_drc),
mee_end,
};
@@ -519,7 +521,7 @@ static int menu_loop_video_options(int id, int keys)
static int sel = 0;
me_loop(e_menu_video_options, &sel);
- scale_update_scaler();
+ plat_reinit();
return 0;
}
@@ -676,7 +678,7 @@ void menu_loop(void)
me_enable(e_menu_main, MA_MAIN_SAVE_STATE, state_allowed());
me_enable(e_menu_main, MA_MAIN_LOAD_STATE, state_allowed());
me_enable(e_menu_main, MA_MAIN_CHEATS, cheats != NULL);
-
+
me_enable(e_menu_main, MA_MAIN_DISC_CTRL, needs_disc_ctrl);
if (override)