diff --git a/audio/resamplers/resampler.c b/audio/resamplers/resampler.c index 66ba42cccf..28557f5472 100644 --- a/audio/resamplers/resampler.c +++ b/audio/resamplers/resampler.c @@ -46,6 +46,7 @@ static int find_resampler_driver_index(const char *drv) } #if !defined(RESAMPLER_TEST) && defined(RARCH_INTERNAL) +#include #include "../../general.h" void find_prev_resampler_driver(void) @@ -69,6 +70,33 @@ void find_next_resampler_driver(void) RARCH_WARN("Couldn't find any next resampler driver (current one: \"%s\").\n", driver.resampler->ident); } + +const char* config_get_audio_resampler_driver_options(void) +{ + union string_list_elem_attr attr; + char *options = NULL; + int option_k = 0; + int options_len = 0; + struct string_list *options_l = string_list_new(); + + attr.i = 0; + + for (option_k = 0; resampler_drivers[option_k]; option_k++) + { + const char *opt = resampler_drivers[option_k]->ident; + options_len += strlen(opt) + 1; + string_list_append(options_l, opt, attr); + } + + options = (char*)calloc(options_len, sizeof(char)); + + string_list_join_concat(options, options_len, options_l, "|"); + + string_list_free(options_l); + options_l = NULL; + + return options; +} #endif /* Resampler is used by multiple modules so avoid diff --git a/driver.h b/driver.h index 126f252a12..b84832a1e8 100644 --- a/driver.h +++ b/driver.h @@ -570,6 +570,8 @@ void uninit_drivers(int flags); void find_prev_driver(const char *label, char *str, size_t sizeof_str); void find_next_driver(const char *label, char *str, size_t sizeof_str); + +const char* config_get_audio_resampler_driver_options(void); void find_prev_resampler_driver(void); void find_next_resampler_driver(void); diff --git a/settings_data.c b/settings_data.c index 8c308640da..57b95720bb 100644 --- a/settings_data.c +++ b/settings_data.c @@ -3066,11 +3066,12 @@ static bool setting_data_append_list_driver_options( NULL); settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER); - CONFIG_STRING( + CONFIG_STRING_OPTIONS( g_settings.audio.resampler, "audio_resampler_driver", "Audio Resampler Driver", config_get_default_audio_resampler(), + config_get_audio_resampler_driver_options(), group_info.name, subgroup_info.name, NULL,