Add option to mute sound on turbo

This commit is contained in:
Brandon Wright 2016-08-02 10:31:05 -05:00
parent 65ca7b6fce
commit 1442378a13
5 changed files with 43 additions and 2 deletions

View File

@ -139,6 +139,7 @@ Snes9xConfig::load_defaults (void)
pause_emulation_on_switch = 0;
num_threads = 2;
mute_sound = FALSE;
mute_sound_turbo = FALSE;
fullscreen = FALSE;
ui_visible = TRUE;
statusbar_visible = FALSE;
@ -348,6 +349,7 @@ Snes9xConfig::save_config_file (void)
xml_out_string (xml, "netplay_last_host", netplay_last_host);
xml_out_int (xml, "mute_sound", mute_sound);
xml_out_int (xml, "mute_sound_turbo", mute_sound_turbo);
xml_out_int (xml, "sound_buffer_size", sound_buffer_size);
xml_out_int (xml, "sound_driver", sound_driver);
xml_out_int (xml, "sound_input_rate", sound_input_rate);
@ -598,6 +600,10 @@ Snes9xConfig::set_option (const char *name, const char *value)
{
mute_sound = atoi (value);
}
else if (!strcasecmp (name, "mute_sound_turbo"))
{
mute_sound_turbo = atoi (value);
}
else if (!strcasecmp (name, "16bit_sound"))
{
Settings.SixteenBitSound = atoi (value);

View File

@ -119,6 +119,7 @@ class Snes9xConfig
/* Operational */
int sound_driver;
int mute_sound;
int mute_sound_turbo;
int sound_buffer_size;
int sound_playback_rate;
int sound_input_rate;

View File

@ -660,6 +660,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
set_check ("pause_emulation_on_switch", config->pause_emulation_on_switch);
set_spin ("num_threads", config->num_threads);
set_check ("mute_sound_check", config->mute_sound);
set_check ("mute_sound_turbo_check", config->mute_sound_turbo);
set_spin ("sound_buffer_size", config->sound_buffer_size);
set_slider ("sound_input_rate", config->sound_input_rate);
set_check ("sync_sound", Settings.SoundSync);
@ -815,6 +816,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
config->sound_input_rate = get_slider ("sound_input_rate");
Settings.SoundSync = get_check ("sync_sound");
config->mute_sound = get_check ("mute_sound_check");
config->mute_sound_turbo = get_check ("mute_sound_turbo_check");
store_ntsc_settings ();
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");

View File

@ -358,6 +358,22 @@ S9xIdleFunc (gpointer data)
{
#endif
S9xMainLoop ();
static int muted_from_turbo = FALSE;
static int mute_saved_state = FALSE;
if (Settings.TurboMode && !muted_from_turbo && gui_config->mute_sound_turbo)
{
muted_from_turbo = TRUE;
mute_saved_state = Settings.Mute;
}
if (!Settings.TurboMode && muted_from_turbo)
{
muted_from_turbo = FALSE;
Settings.Mute = mute_saved_state;
}
S9xMixSound ();
#ifdef NETPLAY_SUPPORT

View File

@ -3983,6 +3983,22 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="mute_sound_turbo_check">
<property name="label" translatable="yes">Mute sound when using turbo</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Disables output of sound when using turbo</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="stereo_check">
<property name="label" translatable="yes">Stereo</property>
@ -3996,7 +4012,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@ -4172,7 +4188,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
</object>