Add 'Remove DSP Plugin' menu entry

This commit is contained in:
jdgleaver 2020-10-19 11:30:28 +01:00
parent 775ea737f2
commit a02fadeb94
11 changed files with 92 additions and 4 deletions

View File

@ -86,6 +86,10 @@ MSG_HASH(
MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN,
"audio_dsp_plugin"
)
MSG_HASH(
MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE,
"audio_dsp_plugin_remove"
)
MSG_HASH(
MENU_ENUM_LABEL_AUDIO_ENABLE,
"audio_enable"

View File

@ -1813,6 +1813,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN,
"Audio DSP plugin that processes audio before it's sent to the driver."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN_REMOVE,
"Remove DSP Plugin"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN_REMOVE,
"Unload any active audio DSP plugin."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE,
"WASAPI Exclusive Mode"

View File

@ -2990,6 +2990,30 @@ static int action_ok_video_filter_remove(const char *path,
return 0;
}
static int action_ok_audio_dsp_plugin_remove(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
if (!settings)
return menu_cbs_exit();
if (!string_is_empty(settings->paths.path_audio_dsp_plugin))
{
bool refresh = false;
/* Unload dsp plugin filter */
settings->paths.path_audio_dsp_plugin[0] = '\0';
command_event(CMD_EVENT_DSP_FILTER_INIT, NULL);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
}
return 0;
}
#ifdef HAVE_CHEATS
static void menu_input_st_string_cb_cheat_file_save_as(
void *userdata, const char *str)
@ -8027,6 +8051,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_ACTION_VIDEO_FILTER_REMOVE:
BIND_ACTION_OK(cbs, action_ok_video_filter_remove);
break;
case MENU_SETTING_ACTION_AUDIO_DSP_PLUGIN_REMOVE:
BIND_ACTION_OK(cbs, action_ok_audio_dsp_plugin_remove);
break;
default:
return -1;
}

View File

@ -128,6 +128,31 @@ static int action_start_video_filter_file_load(
return 0;
}
static int action_start_audio_dsp_plugin_file_load(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
if (!settings)
return menu_cbs_exit();
if (!string_is_empty(settings->paths.path_audio_dsp_plugin))
{
bool refresh = false;
/* Unload dsp plugin filter */
settings->paths.path_audio_dsp_plugin[0] = '\0';
command_event(CMD_EVENT_DSP_FILTER_INIT, NULL);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
}
return 0;
}
static int generic_action_start_performance_counters(struct retro_perf_counter **counters,
unsigned offset, unsigned type, const char *label)
{
@ -615,6 +640,9 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs)
case MENU_ENUM_LABEL_VIDEO_FILTER:
BIND_ACTION_START(cbs, action_start_video_filter_file_load);
break;
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
BIND_ACTION_START(cbs, action_start_audio_dsp_plugin_file_load);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_pass);

View File

@ -513,6 +513,7 @@ 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_dsp_plugin_remove, MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN_REMOVE)
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)
@ -2773,6 +2774,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_dsp_plugin);
break;
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_dsp_plugin_remove);
break;
case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_output_rate);
break;

View File

@ -9781,6 +9781,7 @@ static void materialui_list_insert(
case MENU_SETTING_ACTION_CORE_DELETE:
case MENU_SETTING_ACTION_CORE_DELETE_BACKUP:
case MENU_SETTING_ACTION_VIDEO_FILTER_REMOVE:
case MENU_SETTING_ACTION_AUDIO_DSP_PLUGIN_REMOVE:
node->icon_texture_index = MUI_TEXTURE_REMOVE;
node->icon_type = MUI_ICON_TYPE_INTERNAL;
break;

View File

@ -249,6 +249,7 @@ uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_DELETE_PLAYLIST:
case MENU_ENUM_LABEL_CORE_DELETE_BACKUP_LIST:
case MENU_ENUM_LABEL_VIDEO_FILTER_REMOVE:
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOSE];
case MENU_ENUM_LABEL_CORE_LOCK:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE];

View File

@ -2696,6 +2696,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_DELETE_PLAYLIST:
case MENU_ENUM_LABEL_CORE_DELETE_BACKUP_LIST:
case MENU_ENUM_LABEL_VIDEO_FILTER_REMOVE:
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE:
return xmb->textures.list[XMB_TEXTURE_CLOSE];
case MENU_ENUM_LABEL_CORE_LOCK:
return xmb->textures.list[XMB_TEXTURE_CORE];

View File

@ -5625,10 +5625,22 @@ unsigned menu_displaylist_build_list(
count++;
#ifdef HAVE_DSP_FILTER
{
settings_t *settings = config_get_ptr();
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN,
PARSE_ONLY_PATH, false) == 0)
count++;
if (!string_is_empty(settings->paths.path_audio_dsp_plugin))
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN_REMOVE),
msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE),
MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN_REMOVE,
MENU_SETTING_ACTION_AUDIO_DSP_PLUGIN_REMOVE, 0, 0))
count++;
}
#endif
break;
case DISPLAYLIST_VIDEO_SETTINGS_LIST:

View File

@ -221,6 +221,7 @@ enum menu_settings_type
MENU_SETTING_ITEM_CORE_DELETE_BACKUP,
MENU_SETTING_ACTION_VIDEO_FILTER_REMOVE,
MENU_SETTING_ACTION_AUDIO_DSP_PLUGIN_REMOVE,
MENU_SETTINGS_LAST
};

View File

@ -1598,6 +1598,7 @@ enum msg_hash_enums
MENU_LABEL(AUDIO_DEVICE),
MENU_LABEL(AUDIO_BLOCK_FRAMES),
MENU_LABEL(AUDIO_DSP_PLUGIN),
MENU_LABEL(AUDIO_DSP_PLUGIN_REMOVE),
MENU_LABEL(AUDIO_MUTE),
MENU_LABEL(AUDIO_MIXER_MUTE),
MENU_LABEL(AUDIO_FASTFORWARD_MUTE),