Reimplement get_value callback for audio resampler quality - action OK

now triggers a dropdown list
This commit is contained in:
twinaphex 2018-09-23 11:25:24 +02:00
parent e9516827b9
commit 242a7eb914
2 changed files with 42 additions and 52 deletions

View File

@ -17,7 +17,6 @@
#include <compat/strl.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
#include <audio/audio_resampler.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -281,52 +280,6 @@ static void menu_action_setting_disp_set_label_shader_filter_pass(
}
}
static void menu_action_setting_disp_set_label_audio_resampler_quality(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
if (settings)
{
switch (settings->uints.audio_resampler_quality)
{
case RESAMPLER_QUALITY_DONTCARE:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE),
len);
break;
case RESAMPLER_QUALITY_LOWEST:
strlcpy(s, "Lowest",
len);
break;
case RESAMPLER_QUALITY_LOWER:
strlcpy(s, "Lower",
len);
break;
case RESAMPLER_QUALITY_HIGHER:
strlcpy(s, "Higher",
len);
break;
case RESAMPLER_QUALITY_HIGHEST:
strlcpy(s, "Highest",
len);
break;
case RESAMPLER_QUALITY_NORMAL:
strlcpy(s, "Normal",
len);
break;
}
}
}
static void menu_action_setting_disp_set_label_filter(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
@ -2115,10 +2068,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_remap_file_load);
break;
case MENU_ENUM_LABEL_AUDIO_RESAMPLER_QUALITY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_audio_resampler_quality);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_filter_pass);

View File

@ -624,7 +624,8 @@ static void setting_get_string_representation_uint_video_rotation(void *data,
}
}
static void setting_get_string_representation_uint_aspect_ratio_index(void *data,
static void setting_get_string_representation_uint_aspect_ratio_index(
void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
@ -634,6 +635,43 @@ static void setting_get_string_representation_uint_aspect_ratio_index(void *data
len);
}
static void setting_get_string_representation_uint_audio_resampler_quality(
void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return;
switch (*setting->value.target.unsigned_integer)
{
case RESAMPLER_QUALITY_DONTCARE:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE),
len);
break;
case RESAMPLER_QUALITY_LOWEST:
strlcpy(s, "Lowest",
len);
break;
case RESAMPLER_QUALITY_LOWER:
strlcpy(s, "Lower",
len);
break;
case RESAMPLER_QUALITY_HIGHER:
strlcpy(s, "Higher",
len);
break;
case RESAMPLER_QUALITY_HIGHEST:
strlcpy(s, "Highest",
len);
break;
case RESAMPLER_QUALITY_NORMAL:
strlcpy(s, "Normal",
len);
break;
}
}
static void setting_get_string_representation_uint_libretro_device(void *data,
char *s, size_t len)
{
@ -4814,6 +4852,9 @@ static bool setting_append_list(
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_audio_resampler_quality;
menu_settings_list_current_add_range(list, list_info, RESAMPLER_QUALITY_DONTCARE, RESAMPLER_QUALITY_HIGHEST, 1.0, true, true);
CONFIG_FLOAT(