mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
audio mute enable is now saved to config file
This commit is contained in:
parent
88cc144ce0
commit
7f53ca4ab5
@ -374,7 +374,7 @@ void init_audio(void)
|
||||
|
||||
g_extern.measure_data.buffer_free_samples_count = 0;
|
||||
|
||||
if (driver.audio_active && !g_extern.audio_data.mute &&
|
||||
if (driver.audio_active && !g_settings.audio.mute_enable &&
|
||||
g_extern.system.audio_callback.callback)
|
||||
{
|
||||
/* Threaded driver is initially stopped. */
|
||||
|
@ -230,6 +230,7 @@ struct settings
|
||||
{
|
||||
char driver[32];
|
||||
bool enable;
|
||||
bool mute_enable;
|
||||
unsigned out_rate;
|
||||
unsigned block_frames;
|
||||
char device[PATH_MAX_LENGTH];
|
||||
@ -512,7 +513,6 @@ struct global
|
||||
float in_rate;
|
||||
|
||||
bool use_float;
|
||||
bool mute;
|
||||
|
||||
float *outsamples;
|
||||
int16_t *conv_outsamples;
|
||||
|
@ -175,7 +175,7 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
||||
driver.recording->push_audio(driver.recording_data, &ffemu_data);
|
||||
}
|
||||
|
||||
if (g_extern.is_paused || g_extern.audio_data.mute)
|
||||
if (g_extern.is_paused || g_settings.audio.mute_enable)
|
||||
return true;
|
||||
if (!driver.audio_active || !g_extern.audio_data.data)
|
||||
return false;
|
||||
|
@ -2604,7 +2604,7 @@ bool rarch_main_command(unsigned cmd)
|
||||
if (!driver.audio_data || driver.audio->alive(driver.audio_data))
|
||||
return false;
|
||||
|
||||
if (!g_extern.audio_data.mute
|
||||
if (!g_settings.audio.mute_enable
|
||||
&& !driver.audio->start(driver.audio_data))
|
||||
{
|
||||
RARCH_ERR("Failed to start audio driver. Will continue without audio.\n");
|
||||
@ -2613,18 +2613,18 @@ bool rarch_main_command(unsigned cmd)
|
||||
break;
|
||||
case RARCH_CMD_AUDIO_MUTE_TOGGLE:
|
||||
{
|
||||
const char *msg = !g_extern.audio_data.mute ?
|
||||
const char *msg = !g_settings.audio.mute_enable ?
|
||||
"Audio muted." : "Audio unmuted.";
|
||||
|
||||
if (!driver.audio_data || !driver.audio_active)
|
||||
return false;
|
||||
|
||||
g_extern.audio_data.mute = !g_extern.audio_data.mute;
|
||||
g_settings.audio.mute_enable = !g_settings.audio.mute_enable;
|
||||
|
||||
msg_queue_clear(g_extern.msg_queue);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||
|
||||
if (g_extern.audio_data.mute)
|
||||
if (g_settings.audio.mute_enable)
|
||||
rarch_main_command(RARCH_CMD_AUDIO_STOP);
|
||||
else if (!rarch_main_command(RARCH_CMD_AUDIO_START))
|
||||
{
|
||||
|
@ -242,6 +242,9 @@
|
||||
# Enable audio.
|
||||
# audio_enable = true
|
||||
|
||||
# Mutes audio.
|
||||
# audio_mute_enable = false
|
||||
|
||||
# Audio output samplerate.
|
||||
# audio_out_rate = 48000
|
||||
|
||||
|
@ -467,6 +467,7 @@ static void config_set_defaults(void)
|
||||
g_settings.video.rotation = ORIENTATION_NORMAL;
|
||||
|
||||
g_settings.audio.enable = audio_enable;
|
||||
g_settings.audio.mute_enable = false;
|
||||
g_settings.audio.out_rate = out_rate;
|
||||
g_settings.audio.block_frames = 0;
|
||||
if (audio_device)
|
||||
@ -1243,6 +1244,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
|
||||
/* Audio settings. */
|
||||
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
||||
CONFIG_GET_BOOL(audio.mute_enable, "audio_mute_enable");
|
||||
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
||||
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
@ -1843,6 +1845,7 @@ bool config_save_file(const char *path)
|
||||
config_set_string(conf, "video_context_driver", g_settings.video.context_driver);
|
||||
config_set_string(conf, "audio_driver", g_settings.audio.driver);
|
||||
config_set_bool(conf, "audio_enable", g_settings.audio.enable);
|
||||
config_set_bool(conf, "audio_mute_enable", g_settings.audio.mute_enable);
|
||||
config_set_int(conf, "audio_out_rate", g_settings.audio.out_rate);
|
||||
|
||||
config_set_bool(conf, "location_allow", g_settings.location.allow);
|
||||
|
@ -4587,7 +4587,7 @@ static bool setting_data_append_list_audio_options(
|
||||
general_read_handler);
|
||||
|
||||
CONFIG_BOOL(
|
||||
g_extern.audio_data.mute,
|
||||
g_settings.audio.mute_enable,
|
||||
"audio_mute_enable",
|
||||
"Audio Mute",
|
||||
false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user