mirror of
https://github.com/libretro/RetroArch.git
synced 2024-06-02 03:37:24 -04:00
Bring back audio toggling on menu toggle (#16467)
This commit is contained in:
parent
70ac6d9541
commit
5e79dd4569
|
@ -395,23 +395,10 @@ static bool wasapi_alive(void *wh)
|
||||||
return w->running;
|
return w->running;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wasapi_insert_silence(wasapi_t *w)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 12; i++)
|
|
||||||
audio_driver_menu_sample();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void wasapi_set_nonblock_state(void *wh, bool nonblock)
|
static void wasapi_set_nonblock_state(void *wh, bool nonblock)
|
||||||
{
|
{
|
||||||
wasapi_t *w = (wasapi_t*)wh;
|
wasapi_t *w = (wasapi_t*)wh;
|
||||||
|
|
||||||
/* Since exclusive mode keeps repeating last sample while
|
|
||||||
* in paused menu, generate some silence first. */
|
|
||||||
if (!nonblock && w->exclusive)
|
|
||||||
wasapi_insert_silence(w);
|
|
||||||
|
|
||||||
w->nonblock = nonblock;
|
w->nonblock = nonblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6263,7 +6263,8 @@ void menu_driver_toggle(
|
||||||
* struct is NULL
|
* struct is NULL
|
||||||
*/
|
*/
|
||||||
video_driver_t *current_video = (video_driver_t*)curr_video_data;
|
video_driver_t *current_video = (video_driver_t*)curr_video_data;
|
||||||
bool pause_libretro = false;
|
bool menu_pause_libretro = false;
|
||||||
|
bool audio_enable_menu = false;
|
||||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||||
struct menu_state *menu_st = &menu_driver_state;
|
struct menu_state *menu_st = &menu_driver_state;
|
||||||
bool runloop_shutdown_initiated = (runloop_st->flags &
|
bool runloop_shutdown_initiated = (runloop_st->flags &
|
||||||
|
@ -6277,10 +6278,13 @@ void menu_driver_toggle(
|
||||||
if (settings)
|
if (settings)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
pause_libretro = settings->bools.menu_pause_libretro &&
|
menu_pause_libretro = settings->bools.menu_pause_libretro
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
#else
|
#else
|
||||||
pause_libretro = settings->bools.menu_pause_libretro;
|
menu_pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_AUDIOMIXER
|
||||||
|
audio_enable_menu = settings->bools.audio_enable_menu;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
input_overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu;
|
input_overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu;
|
||||||
|
@ -6346,11 +6350,10 @@ void menu_driver_toggle(
|
||||||
/* Stop all rumbling before entering the menu. */
|
/* Stop all rumbling before entering the menu. */
|
||||||
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
|
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
|
||||||
|
|
||||||
if (pause_libretro)
|
if (menu_pause_libretro)
|
||||||
{
|
{
|
||||||
#ifdef PS2
|
if (!audio_enable_menu)
|
||||||
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
||||||
#endif
|
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@ -6379,11 +6382,10 @@ void menu_driver_toggle(
|
||||||
if (!runloop_shutdown_initiated)
|
if (!runloop_shutdown_initiated)
|
||||||
driver_set_nonblock_state();
|
driver_set_nonblock_state();
|
||||||
|
|
||||||
if (pause_libretro)
|
if (menu_pause_libretro)
|
||||||
{
|
{
|
||||||
#ifdef PS2
|
if (!audio_enable_menu)
|
||||||
command_event(CMD_EVENT_AUDIO_START, NULL);
|
command_event(CMD_EVENT_AUDIO_START, NULL);
|
||||||
#endif
|
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8640,9 +8640,15 @@ static void general_write_handler(rarch_setting_t *setting)
|
||||||
case MENU_ENUM_LABEL_AUDIO_ENABLE_MENU:
|
case MENU_ENUM_LABEL_AUDIO_ENABLE_MENU:
|
||||||
#ifdef HAVE_AUDIOMIXER
|
#ifdef HAVE_AUDIOMIXER
|
||||||
if (settings->bools.audio_enable_menu)
|
if (settings->bools.audio_enable_menu)
|
||||||
|
{
|
||||||
|
command_event(CMD_EVENT_AUDIO_START, NULL);
|
||||||
audio_driver_load_system_sounds();
|
audio_driver_load_system_sounds();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
||||||
|
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case MENU_ENUM_LABEL_MENU_SOUND_BGM:
|
case MENU_ENUM_LABEL_MENU_SOUND_BGM:
|
||||||
|
|
58
retroarch.c
58
retroarch.c
|
@ -3861,23 +3861,50 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_AUDIO_STOP:
|
case CMD_EVENT_AUDIO_STOP:
|
||||||
|
{
|
||||||
|
bool menu_pause_libretro = false;
|
||||||
|
bool audio_enable_menu = false;
|
||||||
|
|
||||||
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
||||||
if ( settings->bools.audio_enable_menu
|
audio_enable_menu = settings->bools.audio_enable_menu
|
||||||
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
|
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE;
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
if (!audio_driver_stop())
|
#ifdef HAVE_NETWORKING
|
||||||
return false;
|
menu_pause_libretro = settings->bools.menu_pause_libretro
|
||||||
|
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
|
#else
|
||||||
|
menu_pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (audio_enable_menu || !menu_pause_libretro)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!audio_driver_stop())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_AUDIO_START:
|
case CMD_EVENT_AUDIO_START:
|
||||||
|
{
|
||||||
|
bool menu_pause_libretro = false;
|
||||||
|
bool audio_enable_menu = false;
|
||||||
|
|
||||||
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
||||||
if ( settings->bools.audio_enable_menu
|
audio_enable_menu = settings->bools.audio_enable_menu
|
||||||
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
|
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE;
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
if (!audio_driver_start(runloop_st->flags &
|
#ifdef HAVE_NETWORKING
|
||||||
RUNLOOP_FLAG_SHUTDOWN_INITIATED))
|
menu_pause_libretro = settings->bools.menu_pause_libretro
|
||||||
return false;
|
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
|
#else
|
||||||
|
menu_pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (audio_enable_menu && !menu_pause_libretro)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!audio_driver_start(runloop_st->flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
case CMD_EVENT_MICROPHONE_STOP:
|
case CMD_EVENT_MICROPHONE_STOP:
|
||||||
|
@ -4664,19 +4691,22 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro
|
bool menu_pause_libretro = settings->bools.menu_pause_libretro
|
||||||
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
#else
|
#else
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro;
|
bool menu_pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (menu_pause_libretro)
|
if (menu_pause_libretro)
|
||||||
{
|
{
|
||||||
|
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
command_event(CMD_EVENT_AUDIO_START, NULL);
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue