diff --git a/audio/audio_defines.h b/audio/audio_defines.h index 74224d6cad..afbb01cd37 100644 --- a/audio/audio_defines.h +++ b/audio/audio_defines.h @@ -30,7 +30,7 @@ RETRO_BEGIN_DECLS #define AUDIO_MIXER_MAX_STREAMS 16 -#define AUDIO_MIXER_MAX_SYSTEM_STREAMS (AUDIO_MIXER_MAX_STREAMS + 5) +#define AUDIO_MIXER_MAX_SYSTEM_STREAMS (AUDIO_MIXER_MAX_STREAMS + 7) /* do not define more than (MAX_SYSTEM_STREAMS - MAX_STREAMS) */ enum audio_mixer_system_slot @@ -39,7 +39,9 @@ enum audio_mixer_system_slot AUDIO_MIXER_SYSTEM_SLOT_CANCEL, AUDIO_MIXER_SYSTEM_SLOT_NOTICE, AUDIO_MIXER_SYSTEM_SLOT_BGM, - AUDIO_MIXER_SYSTEM_SLOT_ACHIEVEMENT_UNLOCK + AUDIO_MIXER_SYSTEM_SLOT_ACHIEVEMENT_UNLOCK, + AUDIO_MIXER_SYSTEM_SLOT_UP, + AUDIO_MIXER_SYSTEM_SLOT_DOWN }; enum audio_action diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 1a2c19260e..5ca563ef9f 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -1343,12 +1343,15 @@ void audio_driver_load_system_sounds(void) const bool audio_enable_menu_cancel = audio_enable_menu && settings->bools.audio_enable_menu_cancel; const bool audio_enable_menu_notice = audio_enable_menu && settings->bools.audio_enable_menu_notice; const bool audio_enable_menu_bgm = audio_enable_menu && settings->bools.audio_enable_menu_bgm; + const bool audio_enable_menu_scroll = audio_enable_menu && settings->bools.audio_enable_menu_scroll; const bool audio_enable_cheevo_unlock = settings->bools.cheevos_unlock_sound_enable; const char *path_ok = NULL; const char *path_cancel = NULL; const char *path_notice = NULL; const char *path_bgm = NULL; const char *path_cheevo_unlock = NULL; + const char *path_up = NULL; + const char *path_down = NULL; struct string_list *list = NULL; struct string_list *list_fallback = NULL; unsigned i = 0; @@ -1414,6 +1417,10 @@ void audio_driver_load_system_sounds(void) path_bgm = path; else if (string_is_equal_noncase(basename_noext, "unlock")) path_cheevo_unlock = path; + else if (string_is_equal_noncase(basename_noext, "up")) + path_up = path; + else if (string_is_equal_noncase(basename_noext, "down")) + path_down = path; } } @@ -1427,7 +1434,13 @@ void audio_driver_load_system_sounds(void) task_push_audio_mixer_load(path_bgm, audio_driver_load_menu_bgm_callback, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_BGM); if (path_cheevo_unlock && audio_enable_cheevo_unlock) task_push_audio_mixer_load(path_cheevo_unlock, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_ACHIEVEMENT_UNLOCK); - + if (audio_enable_menu_scroll) + { + if (path_up) + task_push_audio_mixer_load(path_up, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_UP); + if (path_down) + task_push_audio_mixer_load(path_down, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_DOWN); + } end: if (list) string_list_free(list); @@ -1453,6 +1466,18 @@ void audio_driver_mixer_play_menu_sound(unsigned i) audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING); } +void audio_driver_mixer_play_scroll_sound(bool direction_up) +{ + settings_t *settings = config_get_ptr(); + bool audio_enable_menu = settings->bools.audio_enable_menu; + bool audio_enable_menu_scroll = settings->bools.audio_enable_menu_scroll; + if (audio_enable_menu && audio_enable_menu_scroll) + { + audio_driver_mixer_stop_stream(direction_up ? AUDIO_MIXER_SYSTEM_SLOT_UP : AUDIO_MIXER_SYSTEM_SLOT_DOWN); + audio_driver_mixer_play_menu_sound(direction_up ? AUDIO_MIXER_SYSTEM_SLOT_UP : AUDIO_MIXER_SYSTEM_SLOT_DOWN); + } +} + void audio_driver_mixer_play_stream_looped(unsigned i) { audio_driver_st.mixer_streams[i].stop_cb = audio_mixer_play_stop_cb; diff --git a/audio/audio_driver.h b/audio/audio_driver.h index f7e8e429c4..481392db35 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -267,6 +267,8 @@ void audio_driver_mixer_play_stream(unsigned i); void audio_driver_mixer_play_menu_sound(unsigned i); +void audio_driver_mixer_play_scroll_sound(bool direction_up); + void audio_driver_mixer_play_menu_sound_looped(unsigned i); void audio_driver_mixer_play_stream_sequential(unsigned i); diff --git a/config.def.h b/config.def.h index 6a214c73a1..8c99b5ee3a 100644 --- a/config.def.h +++ b/config.def.h @@ -981,6 +981,7 @@ #define DEFAULT_AUDIO_ENABLE_MENU_CANCEL false #define DEFAULT_AUDIO_ENABLE_MENU_NOTICE false #define DEFAULT_AUDIO_ENABLE_MENU_BGM false +#define DEFAULT_AUDIO_ENABLE_MENU_SCROLL false #ifdef HAVE_GFX_WIDGETS #define DEFAULT_MENU_ENABLE_WIDGETS true diff --git a/configuration.c b/configuration.c index fd4b96e7dc..814d036dd4 100644 --- a/configuration.c +++ b/configuration.c @@ -1751,6 +1751,8 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("audio_enable_menu_cancel", &settings->bools.audio_enable_menu_cancel, true, DEFAULT_AUDIO_ENABLE_MENU_CANCEL, false); SETTING_BOOL("audio_enable_menu_notice", &settings->bools.audio_enable_menu_notice, true, DEFAULT_AUDIO_ENABLE_MENU_NOTICE, false); SETTING_BOOL("audio_enable_menu_bgm", &settings->bools.audio_enable_menu_bgm, true, DEFAULT_AUDIO_ENABLE_MENU_BGM, false); + SETTING_BOOL("audio_enable_menu_scroll", &settings->bools.audio_enable_menu_scroll, true, DEFAULT_AUDIO_ENABLE_MENU_SCROLL, false); + SETTING_BOOL("audio_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE), true, false, false); #ifdef HAVE_AUDIOMIXER SETTING_BOOL("audio_mixer_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MIXER_MUTE_ENABLE), true, false, false); diff --git a/configuration.h b/configuration.h index dbe94a7fae..1d0bdfef25 100644 --- a/configuration.h +++ b/configuration.h @@ -596,6 +596,7 @@ typedef struct settings bool audio_enable_menu_cancel; bool audio_enable_menu_notice; bool audio_enable_menu_bgm; + bool audio_enable_menu_scroll; bool audio_sync; bool audio_rate_control; bool audio_wasapi_exclusive_mode; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index f2dcc254c0..a8ced36c62 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -5102,6 +5102,10 @@ MSG_HASH( MENU_ENUM_LABEL_MENU_SOUND_BGM, "menu_sound_bgm" ) +MSG_HASH( + MENU_ENUM_LABEL_MENU_SOUND_SCROLL, + "menu_sound_scroll" + ) MSG_HASH( MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG, "content_runtime_log" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index f46abe72a9..df71fbfd20 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2483,6 +2483,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SOUND_BGM, "Enable 'BGM' Sound" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SOUND_SCROLL, + "Enable 'Scroll' Sounds" + ) /* Settings > Input */ diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 2d22b322bb..c59d531626 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -56,6 +56,7 @@ #include "../../input/input_osk.h" #include "../../configuration.h" +#include "../../audio/audio_driver.h" #include "../../content.h" #include "../../core_info.h" @@ -7871,10 +7872,21 @@ static enum menu_action ozone_parse_menu_entry_action( new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE; ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(false); +#endif break; + + } + else { +#ifdef HAVE_AUDIOMIXER + if (selection_total > 1) // if there's only one option, don't play the sound + audio_driver_mixer_play_scroll_sound(false); +#endif + if (!menu_navigation_wraparound_enable && selection == selection_total - 1) + ozone_start_cursor_wiggle(ozone, MENU_ACTION_DOWN); } - else if (!menu_navigation_wraparound_enable && selection == selection_total - 1) - ozone_start_cursor_wiggle(ozone, MENU_ACTION_DOWN); if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) && (ozone->is_quick_menu)) @@ -7900,14 +7912,24 @@ static enum menu_action ozone_parse_menu_entry_action( new_selection = horizontal_list_size + ozone->system_tab_end; ozone_sidebar_goto(ozone, new_selection); - new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE; ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif break; } - else if (!menu_navigation_wraparound_enable && selection == 0) - ozone_start_cursor_wiggle(ozone, MENU_ACTION_UP); - + else { +#ifdef HAVE_AUDIOMIXER + if (selection_total > 1) + audio_driver_mixer_play_scroll_sound(true); +#endif + if (!menu_navigation_wraparound_enable && selection == 0) + ozone_start_cursor_wiggle(ozone, MENU_ACTION_UP); + } + if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) && (ozone->is_quick_menu)) return MENU_ACTION_NOOP; @@ -7950,7 +7972,9 @@ static enum menu_action ozone_parse_menu_entry_action( } ozone_go_to_sidebar(ozone, ozone_collapse_sidebar, tag); - +#ifdef HAVE_AUDIOMIXER + audio_driver_mixer_play_scroll_sound(true); +#endif new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE; break; case MENU_ACTION_RIGHT: @@ -7978,8 +8002,12 @@ static enum menu_action ozone_parse_menu_entry_action( break; } - if (!(ozone->flags & OZONE_FLAG_EMPTY_PLAYLIST)) + if (!(ozone->flags & OZONE_FLAG_EMPTY_PLAYLIST)) { ozone_leave_sidebar(ozone, ozone_collapse_sidebar, tag); +#ifdef HAVE_AUDIOMIXER + audio_driver_mixer_play_scroll_sound(false); +#endif + } new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_LABEL; break; @@ -8159,11 +8187,11 @@ static int ozone_menu_entry_action( /* Check whether current selection has changed * (due to automatic on screen entry selection...) */ size_t new_selection = menu_navigation_get_selection(); - if (new_selection != selection) { /* Selection has changed - must update * entry pointer */ + MENU_ENTRY_INITIALIZE(new_entry); menu_entry_get(&new_entry, 0, new_selection, NULL, true); entry_ptr = &new_entry; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 63f4a0a64a..30237b1715 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -9779,6 +9779,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_MENU_SOUND_CANCEL, PARSE_ONLY_BOOL}, {MENU_ENUM_LABEL_MENU_SOUND_NOTICE, PARSE_ONLY_BOOL}, {MENU_ENUM_LABEL_MENU_SOUND_BGM, PARSE_ONLY_BOOL}, + {MENU_ENUM_LABEL_MENU_SOUND_SCROLL, PARSE_ONLY_BOOL}, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index ca9ab15b5e..9f66c6f4f9 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -13223,6 +13223,22 @@ static bool setting_append_list( SD_FLAG_NONE ); + CONFIG_BOOL( + list, list_info, + &settings->bools.audio_enable_menu_scroll, + MENU_ENUM_LABEL_MENU_SOUND_SCROLL, + MENU_ENUM_LABEL_VALUE_MENU_SOUND_SCROLL, + DEFAULT_AUDIO_ENABLE_MENU_SCROLL, + 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 + ); + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); break; diff --git a/msg_hash.h b/msg_hash.h index 75af8084fd..8ee954f707 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3548,6 +3548,7 @@ enum msg_hash_enums MENU_LABEL(MENU_SOUND_CANCEL), MENU_LABEL(MENU_SOUND_NOTICE), MENU_LABEL(MENU_SOUND_BGM), + MENU_LABEL(MENU_SOUND_SCROLL), MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER_FALLBACK, MENU_LABEL(CONTENT_RUNTIME_LOG), MENU_LABEL(CONTENT_RUNTIME_LOG_AGGREGATE),