mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
No longer have to grab settings pointer to get audio mute value
This commit is contained in:
parent
95214e8180
commit
097515fa63
@ -150,6 +150,7 @@ static void *audio_driver_resampler_data = NULL;
|
||||
static const audio_driver_t *current_audio = NULL;
|
||||
static void *audio_driver_context_audio_data = NULL;
|
||||
|
||||
static bool audio_driver_mute_enable = false;
|
||||
static bool audio_driver_use_float = false;
|
||||
static bool audio_driver_active = false;
|
||||
static bool audio_driver_data_own = false;
|
||||
@ -531,7 +532,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
|
||||
&is_perfcnt_enable);
|
||||
|
||||
if (is_paused || settings->bools.audio_mute_enable)
|
||||
if (is_paused || audio_driver_mute_enable)
|
||||
return true;
|
||||
if (!audio_driver_active || !audio_driver_input_data)
|
||||
return false;
|
||||
@ -947,14 +948,13 @@ bool audio_driver_has_callback(void)
|
||||
bool audio_driver_toggle_mute(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool new_mute_state = !settings->bools.audio_mute_enable;
|
||||
bool new_mute_state = !audio_driver_mute_enable;
|
||||
if (!audio_driver_context_audio_data)
|
||||
return false;
|
||||
if (!audio_driver_active)
|
||||
return false;
|
||||
|
||||
configuration_set_bool(settings,
|
||||
settings->bools.audio_mute_enable, new_mute_state);
|
||||
audio_driver_mute_enable = new_mute_state;
|
||||
|
||||
if (new_mute_state)
|
||||
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
||||
@ -1048,3 +1048,16 @@ void audio_driver_destroy(void)
|
||||
audio_driver_data_own = false;
|
||||
current_audio = NULL;
|
||||
}
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case AUDIO_ACTION_MUTE_ENABLE:
|
||||
return &audio_driver_mute_enable;
|
||||
case AUDIO_ACTION_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
enum audio_action
|
||||
{
|
||||
AUDIO_ACTION_NONE = 0,
|
||||
AUDIO_ACTION_MUTE_ENABLE
|
||||
};
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
/* Creates and initializes handle to audio driver.
|
||||
@ -209,6 +215,8 @@ void audio_driver_unset_callback(void);
|
||||
|
||||
void audio_driver_frame_is_reverse(void);
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action);
|
||||
|
||||
bool audio_driver_deinit(void);
|
||||
|
||||
bool audio_driver_init(void);
|
||||
|
@ -2060,7 +2060,8 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_AUDIO_MUTE_TOGGLE:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *msg = !settings->bools.audio_mute_enable ?
|
||||
bool audio_mute_enable = *(audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE));
|
||||
const char *msg = !audio_mute_enable ?
|
||||
msg_hash_to_str(MSG_AUDIO_MUTED):
|
||||
msg_hash_to_str(MSG_AUDIO_UNMUTED);
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("keyboard_gamepad_enable", &settings->bools.input_keyboard_gamepad_enable, true, true, false);
|
||||
SETTING_BOOL("core_set_supports_no_game_enable", &settings->bools.set_supports_no_game_enable, true, true, false);
|
||||
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, audio_enable, false);
|
||||
SETTING_BOOL("audio_mute_enable", &settings->bools.audio_mute_enable, true, false, false);
|
||||
SETTING_BOOL("audio_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE), true, false, false);
|
||||
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
|
||||
SETTING_BOOL("video_font_enable", &settings->bools.video_font_enable, true, font_enable, false);
|
||||
SETTING_BOOL("core_updater_auto_extract_archive", &settings->bools.network_buildbot_auto_extract_archive, true, true, false);
|
||||
|
@ -74,7 +74,6 @@ typedef struct settings
|
||||
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
bool audio_mute_enable;
|
||||
bool audio_sync;
|
||||
bool audio_rate_control;
|
||||
#ifdef HAVE_WASAPI
|
||||
|
@ -3761,7 +3761,7 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.audio_mute_enable,
|
||||
audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE),
|
||||
MENU_ENUM_LABEL_AUDIO_MUTE,
|
||||
MENU_ENUM_LABEL_VALUE_AUDIO_MUTE,
|
||||
false,
|
||||
|
Loading…
Reference in New Issue
Block a user