Merge pull request #4861 from Monroe88/menu_wasapi

Add WASAPI audio driver settings to the menu
This commit is contained in:
Twinaphex 2017-04-29 11:17:15 +02:00 committed by GitHub
commit 936b5e4b7c
8 changed files with 121 additions and 3 deletions

View File

@ -792,6 +792,13 @@ static const float max_timing_skew = 0.05;
/* Default audio volume in dB. (0.0 dB == unity gain). */
static const float audio_volume = 0.0;
#ifdef HAVE_WASAPI
/* WASAPI defaults */
static const bool wasapi_exclusive_mode = true;
static const bool wasapi_float_format = false;
static const unsigned wasapi_sh_buffer_length = 0;
#endif
/* MISC */
/* Enables displaying the current frames per second. */

View File

@ -876,8 +876,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("input_autodetect_enable", &settings->bools.input_autodetect_enable, true, input_autodetect_enable, false);
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, rate_control, false);
#ifdef HAVE_WASAPI
SETTING_BOOL("audio_wasapi_exclusive_mode", &settings->bools.audio_wasapi_exclusive_mode, true, true, false);
SETTING_BOOL("audio_wasapi_float_format", &settings->bools.audio_wasapi_float_format, true, false, false);
SETTING_BOOL("audio_wasapi_exclusive_mode", &settings->bools.audio_wasapi_exclusive_mode, true, wasapi_exclusive_mode, false);
SETTING_BOOL("audio_wasapi_float_format", &settings->bools.audio_wasapi_float_format, true, wasapi_float_format, false);
#endif
if (global)
@ -990,7 +990,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
#ifdef HAVE_WASAPI
SETTING_UINT("audio_wasapi_sh_buffer_length", &settings->uints.audio_wasapi_sh_buffer_length, true, 0, false);
SETTING_UINT("audio_wasapi_sh_buffer_length", &settings->uints.audio_wasapi_sh_buffer_length, true, wasapi_sh_buffer_length, false);
#endif
*size = count;

View File

@ -50,6 +50,12 @@ MSG_HASH(MENU_ENUM_LABEL_AUDIO_SYNC,
"audio_sync")
MSG_HASH(MENU_ENUM_LABEL_AUDIO_VOLUME,
"audio_volume")
MSG_HASH(MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
"audio_wasapi_exclusive_mode")
MSG_HASH(MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT,
"audio_wasapi_float_format")
MSG_HASH(MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
"audio_wasapi_sh_buffer_length")
MSG_HASH(MENU_ENUM_LABEL_AUTOSAVE_INTERVAL,
"autosave_interval")
MSG_HASH(MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE,

View File

@ -274,6 +274,18 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME,
"Audio Volume Level (dB)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE,
"WASAPI Exclusive Mode"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT,
"WASAPI Float Format"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH,
"WASAPI Shared Buffer Length"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL,
"SaveRAM Autosave Interval"
@ -2235,6 +2247,18 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_VOLUME,
"Audio volume (in dB). 0 dB is normal volume, and no gain is applied."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
"Allow the WASAPI driver to take exclusive control of the audio device. If disabled, it will use shared mode instead."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT,
"Use float format for the WASAPI driver, if supported by your audio device."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
"The audio buffer length when using the WASAPI driver in shared mode."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_SYNC,
"Synchronize audio. Recommended."

View File

@ -180,6 +180,9 @@ default_sublabel_macro(action_bind_sublabel_dynamic_wallpaper, MENU_
default_sublabel_macro(action_bind_sublabel_audio_device, MENU_ENUM_SUBLABEL_AUDIO_DEVICE)
default_sublabel_macro(action_bind_sublabel_audio_output_rate, MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE)
default_sublabel_macro(action_bind_sublabel_audio_dsp_plugin, MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN)
default_sublabel_macro(action_bind_sublabel_audio_wasapi_exclusive_mode, MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE)
default_sublabel_macro(action_bind_sublabel_audio_wasapi_float_format, MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT)
default_sublabel_macro(action_bind_sublabel_audio_wasapi_sh_buffer_length, MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH)
default_sublabel_macro(action_bind_sublabel_overlay_opacity, MENU_ENUM_SUBLABEL_OVERLAY_OPACITY)
default_sublabel_macro(action_bind_sublabel_overlay_scale, MENU_ENUM_SUBLABEL_OVERLAY_SCALE)
default_sublabel_macro(action_bind_sublabel_overlay_enable, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE)
@ -799,6 +802,15 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_AUDIO_DEVICE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_device);
break;
case MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_wasapi_exclusive_mode);
break;
case MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_wasapi_float_format);
break;
case MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_wasapi_sh_buffer_length);
break;
case MENU_ENUM_LABEL_MENU_WALLPAPER:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_wallpaper);
break;

View File

@ -5299,6 +5299,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN,
PARSE_ONLY_PATH, false);
#ifdef HAVE_WASAPI
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
PARSE_ONLY_UINT, false);
#endif
info->need_refresh = true;
info->need_push = true;

View File

@ -1680,6 +1680,9 @@ void general_write_handler(void *data)
case MENU_ENUM_LABEL_AUDIO_LATENCY:
case MENU_ENUM_LABEL_AUDIO_DEVICE:
case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE:
case MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE:
case MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT:
case MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH:
rarch_cmd = CMD_EVENT_AUDIO_REINIT;
break;
case MENU_ENUM_LABEL_PAL60_ENABLE:
@ -3920,6 +3923,57 @@ static bool setting_append_list(
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_DSP_FILTER_INIT);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
#ifdef HAVE_WASAPI
if (memcmp(settings->arrays.audio_driver, "wasapi", 6) == 0)
{
CONFIG_BOOL(
list, list_info,
&settings->bools.audio_wasapi_exclusive_mode,
MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE,
wasapi_exclusive_mode,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
list, list_info,
&settings->bools.audio_wasapi_float_format,
MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT,
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT,
wasapi_float_format,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_ADVANCED
);
CONFIG_UINT(
list, list_info,
&settings->uints.audio_wasapi_sh_buffer_length,
MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH,
wasapi_sh_buffer_length,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 1024, 16.0, true, true);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
}
#endif
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
break;

View File

@ -960,6 +960,10 @@ enum msg_hash_enums
MENU_LABEL(AUDIO_VOLUME),
MENU_LABEL(AUDIO_RATE_CONTROL_DELTA),
MENU_LABEL(AUDIO_LATENCY),
MENU_LABEL(AUDIO_WASAPI_EXCLUSIVE_MODE),
MENU_LABEL(AUDIO_WASAPI_FLOAT_FORMAT),
MENU_LABEL(AUDIO_WASAPI_SH_BUFFER_LENGTH),
MENU_LABEL(SAVE_STATE),
MENU_LABEL(LOAD_STATE),
MENU_LABEL(UNDO_LOAD_STATE),