Add compile-time option to show visible annoying red border when sound is overdriven. Leaving it on for a bit at the start of the cycle so that devs might identify and fix some of these cases.

This commit is contained in:
Aaron Giles 2021-08-23 10:47:54 -07:00
parent 895ff8ef02
commit 97d7bfab03
2 changed files with 17 additions and 0 deletions

View File

@ -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);

View File

@ -43,6 +43,8 @@
#include <chrono>
#include <type_traits>
#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);