Skip to content
Browse files

Stop/start audio driver on mute.

  • Loading branch information...
1 parent 70de036 commit e8271031b676d7d69d0f1c5c5e3d22fb0a39ea65 @Themaister committed
Showing with 15 additions and 4 deletions.
  1. +1 −1 driver.c
  2. +1 −1 frontend/frontend.c
  3. +13 −2 retroarch.c
View
2 driver.c
@@ -580,7 +580,7 @@ void init_audio(void)
g_extern.measure_data.buffer_free_samples_count = 0;
- if (g_extern.audio_active && g_extern.system.audio_callback) // Threaded driver is initially stopped.
+ if (g_extern.audio_active && !g_extern.audio_data.mute && g_extern.system.audio_callback) // Threaded driver is initially stopped.
audio_start_func();
}
View
2 frontend/frontend.c
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
driver_set_nonblock_state(driver.nonblock_state);
- if (driver.audio_data && !audio_start_func())
+ if (driver.audio_data && !g_extern.audio_data.mute && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
View
15 retroarch.c
@@ -2223,7 +2223,7 @@ static void check_pause(void)
RARCH_LOG("Unpaused.\n");
if (driver.audio_data)
{
- if (!audio_start_func())
+ if (!g_extern.audio_data.mute && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
@@ -2235,7 +2235,7 @@ static void check_pause(void)
{
RARCH_LOG("Unpaused.\n");
g_extern.is_paused = false;
- if (driver.audio_data && !audio_start_func())
+ if (driver.audio_data && !g_extern.audio_data.mute && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
@@ -2581,6 +2581,17 @@ static void check_mute(void)
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
+ if (driver.audio_data)
+ {
+ if (g_extern.audio_data.mute)
+ audio_stop_func();
+ else if (!audio_start_func())
+ {
+ RARCH_ERR("Failed to unmute audio.\n");
+ g_extern.audio_active = false;
+ }
+ }
+
RARCH_LOG("%s\n", msg);
}

0 comments on commit e827103

Please sign in to comment.
Something went wrong with that request. Please try again.