summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2021-09-24 19:40:10 +0200
committer hap <happppp@users.noreply.github.com>2021-09-24 19:40:10 +0200
commitc9c3cac6c25d6abe80280190c3c80b146fd58d4f (patch)
tree7bfaecd27a57132b15dad0d3f0119d954ec97103 /src/frontend/mame/ui
parent3a2ab1a6c6238aa2c027651ec854ade488034d43 (diff)
sound: make the compressor optional (clamp overdrive to -1.0-1.0 when off)
Diffstat (limited to 'src/frontend/mame/ui')
-rw-r--r--src/frontend/mame/ui/sndmenu.cpp20
-rw-r--r--src/frontend/mame/ui/sndmenu.h3
2 files changed, 19 insertions, 4 deletions
diff --git a/src/frontend/mame/ui/sndmenu.cpp b/src/frontend/mame/ui/sndmenu.cpp
index a3c65e7f6c9..52948c8bca2 100644
--- a/src/frontend/mame/ui/sndmenu.cpp
+++ b/src/frontend/mame/ui/sndmenu.cpp
@@ -28,6 +28,7 @@ menu_sound_options::menu_sound_options(mame_ui_manager &mui, render_container &c
m_sample_rate = mui.machine().options().sample_rate();
m_sound = (strcmp(options.sound(), OSDOPTVAL_NONE) && strcmp(options.sound(), "0"));
m_samples = mui.machine().options().samples();
+ m_compressor = mui.machine().options().compressor();
int total = std::size(m_sound_rate);
@@ -47,15 +48,19 @@ menu_sound_options::~menu_sound_options()
{
emu_options &moptions = machine().options();
- if (strcmp(moptions.value(OSDOPTION_SOUND),m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE)!=0)
+ if (strcmp(moptions.value(OSDOPTION_SOUND), m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE) != 0)
{
moptions.set_value(OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE);
}
- if (moptions.int_value(OPTION_SAMPLERATE)!=m_sound_rate[m_cur_rates])
+ if (moptions.bool_value(OPTION_COMPRESSOR) != m_compressor)
+ {
+ moptions.set_value(OPTION_COMPRESSOR, m_compressor, OPTION_PRIORITY_CMDLINE);
+ }
+ if (moptions.int_value(OPTION_SAMPLERATE) != m_sound_rate[m_cur_rates])
{
moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE);
}
- if (moptions.bool_value(OPTION_SAMPLES)!=m_samples)
+ if (moptions.bool_value(OPTION_SAMPLES) != m_samples)
{
moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE);
}
@@ -84,6 +89,14 @@ void menu_sound_options::handle()
}
break;
+ case ENABLE_COMPRESSOR:
+ if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT)
+ {
+ m_compressor = !m_compressor;
+ changed = true;
+ }
+ break;
+
case SAMPLE_RATE:
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
{
@@ -133,6 +146,7 @@ void menu_sound_options::populate(float &customtop, float &custombottom)
// add options items
item_append_on_off(_("Sound"), m_sound, 0, (void *)(uintptr_t)ENABLE_SOUND);
+ item_append_on_off(_("Compressor"), m_compressor, 0, (void *)(uintptr_t)ENABLE_COMPRESSOR);
item_append(_("Sample Rate"), string_format("%d", m_sample_rate), arrow_flags, (void *)(uintptr_t)SAMPLE_RATE);
item_append_on_off(_("Use External Samples"), m_samples, 0, (void *)(uintptr_t)ENABLE_SAMPLES);
item_append(menu_item_type::SEPARATOR);
diff --git a/src/frontend/mame/ui/sndmenu.h b/src/frontend/mame/ui/sndmenu.h
index 4cecc5dc165..2684f9c7854 100644
--- a/src/frontend/mame/ui/sndmenu.h
+++ b/src/frontend/mame/ui/sndmenu.h
@@ -32,6 +32,7 @@ private:
enum
{
ENABLE_SOUND = 1,
+ ENABLE_COMPRESSOR,
SAMPLE_RATE,
ENABLE_SAMPLES
};
@@ -42,7 +43,7 @@ private:
uint16_t m_cur_rates;
static const int m_sound_rate[];
int m_sample_rate;
- bool m_samples, m_sound;
+ bool m_samples, m_sound, m_compressor;
};
} // namespace ui