summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/ui.cpp
diff options
context:
space:
mode:
author MooglyGuy <MooglyGuy@users.noreply.github.com>2021-03-22 12:40:57 +0100
committer GitHub <noreply@github.com>2021-03-22 22:40:57 +1100
commit8abba577ea3be471c4ec5b0a00af373528658810 (patch)
treedf350d052ff099b7bf6eb96bf79a3b14508bae0d /src/frontend/mame/ui/ui.cpp
parentf1b8f5533bbbc1c07d0eadd8c0301d1751b693ca (diff)
Addressed Github issue #7843 (mute on unthrottle) (#7875)
Diffstat (limited to 'src/frontend/mame/ui/ui.cpp')
-rw-r--r--src/frontend/mame/ui/ui.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index b41c0703ec0..64ee74d8f6b 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -178,6 +178,7 @@ mame_ui_manager::mame_ui_manager(running_machine &machine)
, m_mouse_show(false)
, m_target_font_height(0)
, m_has_warnings(false)
+ , m_unthrottle_mute(false)
, m_machine_info()
, m_unemulated_features()
, m_imperfect_features()
@@ -353,6 +354,13 @@ void mame_ui_manager::initialize(running_machine &machine)
if (field.type() == IPT_DIPSWITCH && strcmp(field.name(), service_mode_dipname) == 0)
field.set_defseq(machine.ioport().type_seq(IPT_SERVICE));
}
+
+ // handle throttle-related options and initial muting state now that the sound manager has been brought up
+ const bool starting_throttle = machine.options().throttle();
+ machine.video().set_throttled(starting_throttle);
+ m_unthrottle_mute = options().unthrottle_mute();
+ if (!starting_throttle && m_unthrottle_mute)
+ machine.sound().ui_mute(true);
}
@@ -1362,7 +1370,12 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
// toggle throttle?
if (machine().ui_input().pressed(IPT_UI_THROTTLE))
- machine().video().set_throttled(!machine().video().throttled());
+ {
+ const bool new_throttle_state = !machine().video().throttled();
+ machine().video().set_throttled(new_throttle_state);
+ if (m_unthrottle_mute)
+ machine().sound().ui_mute(!new_throttle_state);
+ }
// check for fast forward
if (machine().ioport().type_pressed(IPT_UI_FAST_FORWARD))