diff options
| author | 2026-03-11 00:24:52 +0100 | |
|---|---|---|
| committer | 2026-03-11 00:25:03 +0100 | |
| commit | 03fa21d73eadb3fd2527e870e86ab39ab5ddba09 (patch) | |
| tree | f8b4b0796f92897c1a56548eb3cbee62104bbc20 /src/emu | |
| parent | 00d99a4b8784552074f3884cb10369db697bac73 (diff) | |
ui: include fastforward in unthrottle_mute,
sound: don't send sound to osd if mute reason is ui related
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/sound.cpp | 51 |
1 files changed, 21 insertions, 30 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, ¤t_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; |
