diff --git a/src/emu/sound.h b/src/emu/sound.h index 2eccb3cdcc9..fab06bbcea8 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -762,6 +762,7 @@ public: attotime last_update() const { return m_last_update; } int sample_count() const { return m_samples_this_update; } int unique_id() { return m_unique_id++; } + stream_buffer::sample_t compressor_scale() const { return m_compressor_scale; } // allocate a new stream with a new-style callback sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags); diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 22404f32364..c6a7bb21727 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -43,6 +43,8 @@ #include #include +#define VISIBLE_SOUND_OVERDRIVE (1) + /*************************************************************************** CONSTANTS @@ -643,6 +645,20 @@ void mame_ui_manager::update_and_render(render_container &container) container.add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } + // show red if overdriving sound + if (VISIBLE_SOUND_OVERDRIVE && machine().phase() == machine_phase::RUNNING) + { + auto compressor = machine().sound().compressor_scale(); + if (compressor < 1.0) + { + float width = 0.05f + std::min(0.15f, (1.0f - compressor) * 0.4f); + container.add_rect(0.0f, 0.0f, 1.0f, width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container.add_rect(0.0f, 1.0f - width, 1.0f, 1.0f, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container.add_rect(0.0f, width, width, 1.0f - width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container.add_rect(1.0f - width, width, 1.0f, 1.0f - width, rgb_t(0xc0,0xff,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } + } + // render any cheat stuff at the bottom if (machine().phase() >= machine_phase::RESET) mame_machine_manager::instance()->cheat().render_text(*this, container);