gtk:fix audio going on/off when entering Sound Config option

Adds check if sound was already enabled and only then only call
InitSound() when it was not enabled. This seems to be a better option
than calling KillSound() which causes unnecessary audio pop when you
are just entering the menu and not adjusting stuff yet.
This commit is contained in:
retro-wertz 2018-12-10 05:04:07 +08:00
parent 58b4dd0a0f
commit 6432e18a79
1 changed files with 3 additions and 1 deletions

View File

@ -1330,8 +1330,10 @@ void toggleSound(GtkWidget* check, gpointer data)
{
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)))
{
int last_soundopt;
g_config->getOption("SDL.Sound", &last_soundopt);
g_config->setOption("SDL.Sound", 1);
if(GameInfo)
if(GameInfo && !last_soundopt)
InitSound();
}
else