summaryrefslogtreecommitdiffstatshomepage
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
parentf1b8f5533bbbc1c07d0eadd8c0301d1751b693ca (diff)
Addressed Github issue #7843 (mute on unthrottle) (#7875)
-rw-r--r--src/emu/video.cpp2
-rw-r--r--src/frontend/mame/ui/moptions.cpp1
-rw-r--r--src/frontend/mame/ui/moptions.h2
-rw-r--r--src/frontend/mame/ui/ui.cpp15
-rw-r--r--src/frontend/mame/ui/ui.h1
5 files changed, 19 insertions, 2 deletions
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index a4b02e2e2f3..2501cd4966d 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -85,7 +85,7 @@ video_manager::video_manager(running_machine &machine)
, m_overall_real_ticks(0)
, m_overall_emutime(attotime::zero)
, m_overall_valid_counter(0)
- , m_throttled(machine.options().throttle())
+ , m_throttled(true)
, m_throttle_rate(1.0f)
, m_fastforward(false)
, m_seconds_to_run(machine.options().seconds_to_run())
diff --git a/src/frontend/mame/ui/moptions.cpp b/src/frontend/mame/ui/moptions.cpp
index b3b08f6dc3b..cf1d521ef3b 100644
--- a/src/frontend/mame/ui/moptions.cpp
+++ b/src/frontend/mame/ui/moptions.cpp
@@ -56,6 +56,7 @@ const options_entry ui_options::s_option_entries[] =
{ OPTION_LAST_USED_MACHINE, "", OPTION_STRING, "latest used machine" },
{ OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" },
{ OPTION_HIDE_ROMLESS, "1", OPTION_BOOLEAN, "hide romless machine from available list" },
+ { OPTION_UNTHROTTLE_MUTE ";utm", "0", OPTION_BOOLEAN, "mute audio when running unthrottled" },
// UI options
{ nullptr, nullptr, OPTION_HEADER, "UI OPTIONS" },
diff --git a/src/frontend/mame/ui/moptions.h b/src/frontend/mame/ui/moptions.h
index 67ce3eb63f9..a345972bdc0 100644
--- a/src/frontend/mame/ui/moptions.h
+++ b/src/frontend/mame/ui/moptions.h
@@ -50,6 +50,7 @@
#define OPTION_LAST_USED_MACHINE "last_used_machine"
#define OPTION_INFO_AUTO_AUDIT "info_audit_enabled"
#define OPTION_HIDE_ROMLESS "hide_romless"
+#define OPTION_UNTHROTTLE_MUTE "unthrottle_mute"
// core UI options
@@ -115,6 +116,7 @@ public:
int last_right_panel() const { return int_value(OPTION_LAST_RIGHT_PANEL); }
bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); }
bool hide_romless() const { return bool_value(OPTION_HIDE_ROMLESS); }
+ bool unthrottle_mute() const { return bool_value(OPTION_UNTHROTTLE_MUTE); }
// UI options
float infos_size() const { return float_value(OPTION_INFOS_SIZE); }
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))
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index ea9897e78d3..aa169df9fd7 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -235,6 +235,7 @@ private:
ui_colors m_ui_colors;
float m_target_font_height;
bool m_has_warnings;
+ bool m_unthrottle_mute;
std::unique_ptr<ui::machine_info> m_machine_info;
device_feature_set m_unemulated_features;