summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2026-03-11 00:24:52 +0100
committer hap <happppp@users.noreply.github.com>2026-03-11 00:25:03 +0100
commit03fa21d73eadb3fd2527e870e86ab39ab5ddba09 (patch)
treef8b4b0796f92897c1a56548eb3cbee62104bbc20 /src
parent00d99a4b8784552074f3884cb10369db697bac73 (diff)
ui: include fastforward in unthrottle_mute,
sound: don't send sound to osd if mute reason is ui related
Diffstat (limited to 'src')
-rw-r--r--src/emu/sound.cpp51
-rw-r--r--src/frontend/mame/ui/moptions.cpp118
-rw-r--r--src/frontend/mame/ui/moptions.h1
-rw-r--r--src/frontend/mame/ui/ui.cpp17
4 files changed, 88 insertions, 99 deletions
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index 77eb0ab6118..b796820772d 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -74,7 +74,7 @@ template<typename S> void emu::detail::output_buffer_interleaved<S>::prepare_spa
if(!m_channels)
return;
- // Check if potential overflow, bring data back up front if needed
+ // Check if potential overflow, bring data back up front if needed
u32 buffer_size = m_buffer.size() / m_channels;
if(m_write_position + samples > buffer_size) {
u32 source_start = (m_sync_position - m_history) * m_channels;
@@ -84,7 +84,7 @@ template<typename S> void emu::detail::output_buffer_interleaved<S>::prepare_spa
m_sync_position = m_history;
}
- // Clear the destination range
+ // Clear the destination range
u32 fill_start = m_write_position * m_channels;
u32 fill_end = (m_write_position + samples) * m_channels;
std::fill(m_buffer.begin() + fill_start, m_buffer.begin() + fill_end, 0.0);
@@ -155,7 +155,7 @@ template<typename S> void emu::detail::output_buffer_flat<S>::prepare_space(u32
if(!m_channels)
return;
- // Check if potential overflow, bring data back up front if needed
+ // Check if potential overflow, bring data back up front if needed
u32 buffer_size = m_buffer[0].size();
if(m_write_position + samples > buffer_size) {
u32 source_start = m_sync_position - m_history;
@@ -166,7 +166,7 @@ template<typename S> void emu::detail::output_buffer_flat<S>::prepare_space(u32
m_sync_position = m_history;
}
- // Clear the destination range
+ // Clear the destination range
u32 fill_start = m_write_position;
u32 fill_end = m_write_position + samples;
for(u32 channel = 0; channel != m_channels; channel++)
@@ -259,7 +259,6 @@ template<typename S> void emu::detail::output_buffer_flat<S>::resample(u32 previ
std::copy(m_buffer[channel].begin(), m_buffer[channel].begin() + m_write_position, copy.begin());
// Interpolate the buffer contents
-
for(u32 nindex = 0; nindex != nend; nindex++) {
u32 pi0 = std::clamp(pindex, 0U, m_write_position - 1);
u32 pi1 = std::clamp(pindex + 1, 0U, m_write_position - 1);
@@ -707,7 +706,6 @@ void sound_stream::sync(attotime now)
-
attotime sound_stream::sample_to_time(u64 index) const
{
attotime res = attotime::zero;
@@ -864,20 +862,20 @@ void sound_manager::after_devices_init()
// Handle all the ready streams in a lifo matter (better for cache when generating sound)
while(!ready_streams.empty()) {
sound_stream *stream = ready_streams.back();
- // add the stream to the update order
+ // add the stream to the update order
m_ordered_streams.emplace_back(stream);
ready_streams.resize(ready_streams.size() - 1);
- // reduce the depcount for all the streams that depend on the updated stream
+ // reduce the depcount for all the streams that depend on the updated stream
for(sound_stream *target : stream->targets())
if(!--depcounts[target])
- // when the depcount is zero, a stream is ready to be updated
+ // when the depcount is zero, a stream is ready to be updated
ready_streams.emplace_back(target);
}
// If not all streams ended up in the sorted list, we have a loop
if(m_ordered_streams.size() != m_stream_list.size()) {
- // Apply the same algorithm from the other side to the
- // remaining streams to only keep the ones in the loop
+ // Apply the same algorithm from the other side to the
+ // remaining streams to only keep the ones in the loop
std::map<sound_stream *, int> inverted_depcounts;
for(auto &dpc : depcounts)
@@ -960,7 +958,6 @@ void sound_manager::input_get(int id, sound_stream &stream)
u64 dest_end_pos = dest_start_pos + dest_samples;
u32 skip = stream.output_count();
-
for(const auto &step : m_microphones[id].m_input_mixing_steps) {
if(step.m_mode == mixing_step::CLEAR || step.m_mode == mixing_step::COPY)
fatalerror("Impossible step encountered in input\n");
@@ -1034,8 +1031,7 @@ void sound_manager::run_effects()
std::unique_lock<std::mutex> lock(m_effects_mutex);
#endif
- // Copy the data to the effects threads, expanding as needed
- // when -speed is in use
+ // Copy the data to the effects threads, expanding as needed when -speed is in use
double sf = machine().video().speed_factor();
if(sf == 1000) {
for(auto &si : m_speakers) {
@@ -1162,14 +1158,16 @@ void sound_manager::run_effects()
for(auto &si : m_speakers)
si.m_effects.back().m_buffer.sync();
- machine().osd().sound_begin_update();
+ if(!(m_muted & (MUTE_REASON_PAUSE | MUTE_REASON_UI | MUTE_REASON_DEBUGGER))) {
+ machine().osd().sound_begin_update();
- // Send the result to the osd
- for(auto &stream : m_osd_output_streams)
- if(stream.m_samples)
- machine().osd().sound_stream_sink_update(stream.m_id, stream.m_buffer.data(), stream.m_samples);
+ // Send the result to the osd
+ for(auto &stream : m_osd_output_streams)
+ if(stream.m_samples)
+ machine().osd().sound_stream_sink_update(stream.m_id, stream.m_buffer.data(), stream.m_samples);
- machine().osd().sound_end_update();
+ machine().osd().sound_end_update();
+ }
#ifndef SOUND_DISABLE_THREADING
dlock.lock();
@@ -1305,9 +1303,10 @@ void sound_manager::resume()
void sound_manager::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode)
{
- if(cfg_type == config_type::FINAL)
+ if(cfg_type == config_type::FINAL) {
// Note that the config is loaded
m_osd_info.m_generation = 0xffff0001;
+ }
// If no config file, ignore
if(!parentnode)
@@ -1389,7 +1388,6 @@ void sound_manager::config_load(config_type cfg_type, config_level cfg_level, ut
intf->set_user_output_gain(channel, lv_node->get_attribute_float("gain", 1.0));
}
-
// Mapping configuration
m_configs.clear();
for(util::xml::data_node const *node = parentnode->get_child("sound_map"); node != nullptr; node = node->get_next_sibling("sound_map")) {
@@ -1791,7 +1789,6 @@ void sound_manager::startup_cleanups()
}
}
-
// If there's no default source replace all the default source config
// entries into the first source available
if(!osd_info.m_default_source) {
@@ -2103,7 +2100,6 @@ void sound_manager::update_osd_streams()
m_osd_output_streams.clear();
// Find the index of a sound_io_device in the speaker_info vector or the microphone_info vector
-
auto find_sound_io_index = [this](sound_io_device *dev) -> u32 {
for(u32 si = 0; si != m_speakers.size(); si++)
if(&m_speakers[si].m_dev == dev)
@@ -2114,7 +2110,6 @@ void sound_manager::update_osd_streams()
return 0; // Can't happen
};
-
// Find a pointer to a node_info from the node id
auto find_node_info = [this](u32 node) -> const osd::audio_info::node_info * {
for(const auto &ni : m_osd_info.m_nodes) {
@@ -2202,7 +2197,6 @@ void sound_manager::update_osd_streams()
return get_input_stream_for_node_and_device(node, dev, rate, is_system_default, true);
};
-
auto get_output_stream_for_node_and_channel = [this, &get_output_stream_for_node_and_device] (const osd::audio_info::node_info *node, u32 node_channel, sound_io_device *dev, u32 rate, bool is_system_default) -> u32 {
// First check if there's an active stream with the correct channel not used yet
for(u32 sid = 0; sid != m_osd_output_streams.size(); sid++) {
@@ -2354,8 +2348,7 @@ void sound_manager::update_osd_streams()
// Retrieve or create the one osd stream for a given
// destination. First check if we already have it, then
- // whether it was previously created, then otherwise create
- // it.
+ // whether it was previously created, then otherwise create it.
auto get_input_stream_for_node = [this, &current_input_streams, &input_stream_per_node] (const osd::audio_info::node_info *node, u32 rate, bool is_system_default) -> u32 {
// Pick up the existing stream if there's one
@@ -2671,7 +2664,6 @@ void sound_manager::mapping_update()
-
//**// Global sound system update
u64 sound_manager::rate_and_time_to_index(attotime time, u32 sample_rate) const
@@ -2711,7 +2703,6 @@ void sound_manager::streams_update()
#endif
}
-
// Send the hooked samples to lua
{
std::map<std::string, std::vector<std::pair<const float *, int>>> sound_data;
diff --git a/src/frontend/mame/ui/moptions.cpp b/src/frontend/mame/ui/moptions.cpp
index d6eba821947..664cf2063b1 100644
--- a/src/frontend/mame/ui/moptions.cpp
+++ b/src/frontend/mame/ui/moptions.cpp
@@ -20,72 +20,72 @@
const options_entry ui_options::s_option_entries[] =
{
// search path options
- { nullptr, nullptr, option_type::HEADER, "UI SEARCH PATH OPTIONS" },
- { OPTION_HISTORY_PATH, "history;dats;.", option_type::MULTIPATH, "path to system/software info files" },
- { OPTION_CATEGORYINI_PATH, "folders", option_type::MULTIPATH, "path to category ini files" },
- { OPTION_CABINETS_PATH, "cabinets;cabdevs", option_type::MULTIPATH, "path to cabinets / devices image" },
- { OPTION_CPANELS_PATH, "cpanel", option_type::MULTIPATH, "path to control panel image" },
- { OPTION_PCBS_PATH, "pcb", option_type::MULTIPATH, "path to pcbs image" },
- { OPTION_FLYERS_PATH, "flyers", option_type::MULTIPATH, "path to flyers image" },
- { OPTION_TITLES_PATH, "titles", option_type::MULTIPATH, "path to titles image" },
- { OPTION_ENDS_PATH, "ends", option_type::MULTIPATH, "path to ends image" },
- { OPTION_MARQUEES_PATH, "marquees", option_type::MULTIPATH, "path to marquees image" },
+ { nullptr, nullptr, option_type::HEADER, "UI SEARCH PATH OPTIONS" },
+ { OPTION_HISTORY_PATH, "history;dats;.", option_type::MULTIPATH, "path to system/software info files" },
+ { OPTION_CATEGORYINI_PATH, "folders", option_type::MULTIPATH, "path to category ini files" },
+ { OPTION_CABINETS_PATH, "cabinets;cabdevs", option_type::MULTIPATH, "path to cabinets / devices image" },
+ { OPTION_CPANELS_PATH, "cpanel", option_type::MULTIPATH, "path to control panel image" },
+ { OPTION_PCBS_PATH, "pcb", option_type::MULTIPATH, "path to pcbs image" },
+ { OPTION_FLYERS_PATH, "flyers", option_type::MULTIPATH, "path to flyers image" },
+ { OPTION_TITLES_PATH, "titles", option_type::MULTIPATH, "path to titles image" },
+ { OPTION_ENDS_PATH, "ends", option_type::MULTIPATH, "path to ends image" },
+ { OPTION_MARQUEES_PATH, "marquees", option_type::MULTIPATH, "path to marquees image" },
{ OPTION_ARTPREV_PATH, "artwork preview;artpreview", option_type::MULTIPATH, "path to artwork preview image" },
- { OPTION_BOSSES_PATH, "bosses", option_type::MULTIPATH, "path to bosses image" },
- { OPTION_LOGOS_PATH, "logo", option_type::MULTIPATH, "path to logos image" },
- { OPTION_SCORES_PATH, "scores", option_type::MULTIPATH, "path to scores image" },
- { OPTION_VERSUS_PATH, "versus", option_type::MULTIPATH, "path to versus image" },
- { OPTION_GAMEOVER_PATH, "gameover", option_type::MULTIPATH, "path to gameover image" },
- { OPTION_HOWTO_PATH, "howto", option_type::MULTIPATH, "path to howto image" },
- { OPTION_SELECT_PATH, "select", option_type::MULTIPATH, "path to select image" },
- { OPTION_ICONS_PATH, "icons", option_type::MULTIPATH, "path to ICOns image" },
- { OPTION_COVER_PATH, "covers", option_type::MULTIPATH, "path to software cover image" },
- { OPTION_UI_PATH, "ui", option_type::MULTIPATH, "path to UI files" },
+ { OPTION_BOSSES_PATH, "bosses", option_type::MULTIPATH, "path to bosses image" },
+ { OPTION_LOGOS_PATH, "logo", option_type::MULTIPATH, "path to logos image" },
+ { OPTION_SCORES_PATH, "scores", option_type::MULTIPATH, "path to scores image" },
+ { OPTION_VERSUS_PATH, "versus", option_type::MULTIPATH, "path to versus image" },
+ { OPTION_GAMEOVER_PATH, "gameover", option_type::MULTIPATH, "path to gameover image" },
+ { OPTION_HOWTO_PATH, "howto", option_type::MULTIPATH, "path to howto image" },
+ { OPTION_SELECT_PATH, "select", option_type::MULTIPATH, "path to select image" },
+ { OPTION_ICONS_PATH, "icons", option_type::MULTIPATH, "path to ICOns image" },
+ { OPTION_COVER_PATH, "covers", option_type::MULTIPATH, "path to software cover image" },
+ { OPTION_UI_PATH, "ui", option_type::MULTIPATH, "path to UI files" },
// misc options
- { nullptr, nullptr, option_type::HEADER, "UI MISC OPTIONS" },
- { OPTION_SYSTEM_NAMES, "", option_type::MULTIPATH, "translated system names file" },
- { OPTION_SKIP_WARNINGS, "0", option_type::BOOLEAN, "display fewer repeated warnings about imperfect emulation" },
- { OPTION_UNTHROTTLE_MUTE ";utm", "0", option_type::BOOLEAN, "mute audio when running unthrottled" },
+ { nullptr, nullptr, option_type::HEADER, "UI MISC OPTIONS" },
+ { OPTION_SYSTEM_NAMES, "", option_type::MULTIPATH, "translated system names file" },
+ { OPTION_SKIP_WARNINGS, "0", option_type::BOOLEAN, "display fewer repeated warnings about imperfect emulation" },
+ { OPTION_UNTHROTTLE_MUTE ";utm", "0", option_type::BOOLEAN, "mute audio when running unthrottled or when fast-forwarding" },
// UI options
- { nullptr, nullptr, option_type::HEADER, "UI OPTIONS" },
- { OPTION_INFOS_SIZE "(0.20-1.00)", "0.75", option_type::FLOAT, "UI right panel infos text size (0.20 - 1.00)" },
- { OPTION_FONT_ROWS "(25-40)", "30", option_type::INTEGER, "UI font lines per screen (25 - 40)" },
- { OPTION_UI_BORDER_COLOR, "ffffffff", option_type::STRING, "UI border color (ARGB)" },
- { OPTION_UI_BACKGROUND_COLOR, "ef101030", option_type::STRING, "UI background color (ARGB)" },
- { OPTION_UI_CLONE_COLOR, "ff808080", option_type::STRING, "UI clone color (ARGB)" },
- { OPTION_UI_DIPSW_COLOR, "ffffff00", option_type::STRING, "UI dipswitch color (ARGB)" },
- { OPTION_UI_GFXVIEWER_BG_COLOR, "ef101030", option_type::STRING, "UI gfx viewer color (ARGB)" },
- { OPTION_UI_MOUSEDOWN_BG_COLOR, "b0606000", option_type::STRING, "UI mouse down bg color (ARGB)" },
- { OPTION_UI_MOUSEDOWN_COLOR, "ffffff80", option_type::STRING, "UI mouse down color (ARGB)" },
- { OPTION_UI_MOUSEOVER_BG_COLOR, "70404000", option_type::STRING, "UI mouse over bg color (ARGB)" },
- { OPTION_UI_MOUSEOVER_COLOR, "ffffff80", option_type::STRING, "UI mouse over color (ARGB)" },
- { OPTION_UI_SELECTED_BG_COLOR, "ef808000", option_type::STRING, "UI selected bg color (ARGB)" },
- { OPTION_UI_SELECTED_COLOR, "ffffff00", option_type::STRING, "UI selected color (ARGB)" },
- { OPTION_UI_SLIDER_COLOR, "ffffffff", option_type::STRING, "UI slider color (ARGB)" },
- { OPTION_UI_SUBITEM_COLOR, "ffffffff", option_type::STRING, "UI subitem color (ARGB)" },
- { OPTION_UI_TEXT_BG_COLOR, "ef000000", option_type::STRING, "UI text bg color (ARGB)" },
- { OPTION_UI_TEXT_COLOR, "ffffffff", option_type::STRING, "UI text color (ARGB)" },
- { OPTION_UI_UNAVAILABLE_COLOR, "ff404040", option_type::STRING, "UI unavailable color (ARGB)" },
+ { nullptr, nullptr, option_type::HEADER, "UI OPTIONS" },
+ { OPTION_INFOS_SIZE "(0.20-1.00)", "0.75", option_type::FLOAT, "UI right panel infos text size (0.20 - 1.00)" },
+ { OPTION_FONT_ROWS "(25-40)", "30", option_type::INTEGER, "UI font lines per screen (25 - 40)" },
+ { OPTION_UI_BORDER_COLOR, "ffffffff", option_type::STRING, "UI border color (ARGB)" },
+ { OPTION_UI_BACKGROUND_COLOR, "ef101030", option_type::STRING, "UI background color (ARGB)" },
+ { OPTION_UI_CLONE_COLOR, "ff808080", option_type::STRING, "UI clone color (ARGB)" },
+ { OPTION_UI_DIPSW_COLOR, "ffffff00", option_type::STRING, "UI dipswitch color (ARGB)" },
+ { OPTION_UI_GFXVIEWER_BG_COLOR, "ef101030", option_type::STRING, "UI gfx viewer color (ARGB)" },
+ { OPTION_UI_MOUSEDOWN_BG_COLOR, "b0606000", option_type::STRING, "UI mouse down bg color (ARGB)" },
+ { OPTION_UI_MOUSEDOWN_COLOR, "ffffff80", option_type::STRING, "UI mouse down color (ARGB)" },
+ { OPTION_UI_MOUSEOVER_BG_COLOR, "70404000", option_type::STRING, "UI mouse over bg color (ARGB)" },
+ { OPTION_UI_MOUSEOVER_COLOR, "ffffff80", option_type::STRING, "UI mouse over color (ARGB)" },
+ { OPTION_UI_SELECTED_BG_COLOR, "ef808000", option_type::STRING, "UI selected bg color (ARGB)" },
+ { OPTION_UI_SELECTED_COLOR, "ffffff00", option_type::STRING, "UI selected color (ARGB)" },
+ { OPTION_UI_SLIDER_COLOR, "ffffffff", option_type::STRING, "UI slider color (ARGB)" },
+ { OPTION_UI_SUBITEM_COLOR, "ffffffff", option_type::STRING, "UI subitem color (ARGB)" },
+ { OPTION_UI_TEXT_BG_COLOR, "ef000000", option_type::STRING, "UI text bg color (ARGB)" },
+ { OPTION_UI_TEXT_COLOR, "ffffffff", option_type::STRING, "UI text color (ARGB)" },
+ { OPTION_UI_UNAVAILABLE_COLOR, "ff404040", option_type::STRING, "UI unavailable color (ARGB)" },
// system/software selection menu options
- { nullptr, nullptr, option_type::HEADER, "SYSTEM/SOFTWARE SELECTION MENU OPTIONS" },
- { OPTION_HIDE_PANELS "(0-3)", "0", option_type::INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" },
- { OPTION_USE_BACKGROUND, "1", option_type::BOOLEAN, "enable background image in main view" },
- { OPTION_SKIP_BIOS_MENU, "0", option_type::BOOLEAN, "skip bios submenu, start with configured or default" },
- { OPTION_SKIP_PARTS_MENU, "0", option_type::BOOLEAN, "skip parts submenu, start with first part" },
- { OPTION_REMEMBER_LAST, "1", option_type::BOOLEAN, "initially select last used system in main menu" },
- { OPTION_LAST_USED_MACHINE, "", option_type::STRING, "last selected system" },
- { OPTION_LAST_USED_FILTER, "", option_type::STRING, "last used system filter" },
- { OPTION_SYSTEM_RIGHT_PANEL, "image", option_type::STRING, "selected system right panel tab" },
- { OPTION_SOFTWARE_RIGHT_PANEL, "image", option_type::STRING, "selected software right panel tab" },
- { OPTION_SYSTEM_RIGHT_IMAGE, "snap", option_type::STRING, "selected system right panel image" },
- { OPTION_SOFTWARE_RIGHT_IMAGE, "snap", option_type::STRING, "selected software right panel image" },
- { OPTION_ENLARGE_SNAPS, "1", option_type::BOOLEAN, "enlarge images in right panel (keeping aspect ratio)" },
- { OPTION_FORCED4X3, "1", option_type::BOOLEAN, "force 4:3 aspect ratio for snapshots in the software menu" },
- { OPTION_INFO_AUTO_AUDIT, "0", option_type::BOOLEAN, "automatically audit media for the general info panel" },
- { OPTION_HIDE_ROMLESS, "1", option_type::BOOLEAN, "hide systems that don't require ROMs in the available system filter" },
+ { nullptr, nullptr, option_type::HEADER, "SYSTEM/SOFTWARE SELECTION MENU OPTIONS" },
+ { OPTION_HIDE_PANELS "(0-3)", "0", option_type::INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" },
+ { OPTION_USE_BACKGROUND, "1", option_type::BOOLEAN, "enable background image in main view" },
+ { OPTION_SKIP_BIOS_MENU, "0", option_type::BOOLEAN, "skip bios submenu, start with configured or default" },
+ { OPTION_SKIP_PARTS_MENU, "0", option_type::BOOLEAN, "skip parts submenu, start with first part" },
+ { OPTION_REMEMBER_LAST, "1", option_type::BOOLEAN, "initially select last used system in main menu" },
+ { OPTION_LAST_USED_MACHINE, "", option_type::STRING, "last selected system" },
+ { OPTION_LAST_USED_FILTER, "", option_type::STRING, "last used system filter" },
+ { OPTION_SYSTEM_RIGHT_PANEL, "image", option_type::STRING, "selected system right panel tab" },
+ { OPTION_SOFTWARE_RIGHT_PANEL, "image", option_type::STRING, "selected software right panel tab" },
+ { OPTION_SYSTEM_RIGHT_IMAGE, "snap", option_type::STRING, "selected system right panel image" },
+ { OPTION_SOFTWARE_RIGHT_IMAGE, "snap", option_type::STRING, "selected software right panel image" },
+ { OPTION_ENLARGE_SNAPS, "1", option_type::BOOLEAN, "enlarge images in right panel (keeping aspect ratio)" },
+ { OPTION_FORCED4X3, "1", option_type::BOOLEAN, "force 4:3 aspect ratio for snapshots in the software menu" },
+ { OPTION_INFO_AUTO_AUDIT, "0", option_type::BOOLEAN, "automatically audit media for the general info panel" },
+ { OPTION_HIDE_ROMLESS, "1", option_type::BOOLEAN, "hide systems that don't require ROMs in the available system filter" },
// sentinel
{ nullptr }
diff --git a/src/frontend/mame/ui/moptions.h b/src/frontend/mame/ui/moptions.h
index ab854870f32..ed5867f9036 100644
--- a/src/frontend/mame/ui/moptions.h
+++ b/src/frontend/mame/ui/moptions.h
@@ -42,7 +42,6 @@
#define OPTION_SKIP_WARNINGS "skip_warnings"
#define OPTION_UNTHROTTLE_MUTE "unthrottle_mute"
-
// core UI options
#define OPTION_INFOS_SIZE "infos_text_size"
#define OPTION_FONT_ROWS "font_rows"
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index f2c9b7d1608..892e4501315 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -1753,22 +1753,17 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
if (machine().ui_input().pressed(IPT_UI_SHOW_FPS))
set_show_fps(!show_fps());
- // increment frameskip?
+ // increment frameskip
if (machine().ui_input().pressed(IPT_UI_FRAMESKIP_INC))
increase_frameskip();
- // decrement frameskip?
+ // decrement frameskip
if (machine().ui_input().pressed(IPT_UI_FRAMESKIP_DEC))
decrease_frameskip();
- // toggle throttle?
+ // toggle throttle
if (machine().ui_input().pressed(IPT_UI_THROTTLE))
- {
- 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);
- }
+ machine().video().set_throttled(!machine().video().throttled());
// check for fast forward
if (machine().ioport().type_pressed(IPT_UI_FAST_FORWARD))
@@ -1779,6 +1774,10 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
else
machine().video().set_fastforward(false);
+ // update mute when unthrottled
+ if (m_unthrottle_mute)
+ machine().sound().ui_mute(machine().video().fastforward() || !machine().video().throttled());
+
return 0;
}