mirror of
https://github.com/MiSTer-devel/Main_MiSTer.git
synced 2026-05-17 03:04:02 +00:00
audio: add boost.
This commit is contained in:
46
audio.cpp
46
audio.cpp
@@ -22,6 +22,7 @@ static uint8_t vol_att = 0;
|
||||
static uint8_t corevol_att = 0;
|
||||
unsigned long vol_set_timeout = 0;
|
||||
static int has_filter = 0;
|
||||
static int has_boost = 0;
|
||||
|
||||
static char filter_cfg_path[1024] = {};
|
||||
static char filter_cfg[1024] = {};
|
||||
@@ -31,6 +32,8 @@ static void setFilter()
|
||||
fileTYPE f = {};
|
||||
|
||||
has_filter = spi_uio_cmd(UIO_SET_AFILTER);
|
||||
has_boost = (has_filter & 2) && !is_menu();
|
||||
if (!has_boost) corevol_att &= 7;
|
||||
if (!has_filter) return;
|
||||
|
||||
snprintf(filter_cfg_path, sizeof(filter_cfg_path), AFILTER_DIR"/%s", filter_cfg + 1);
|
||||
@@ -140,8 +143,11 @@ int get_volume()
|
||||
|
||||
int get_core_volume()
|
||||
{
|
||||
int boost = corevol_att & 0x60;
|
||||
if (boost > 0x40) boost = 0x40;
|
||||
corevol_att &= 7;
|
||||
if (corevol_att > 6) corevol_att = 6;
|
||||
corevol_att |= boost;
|
||||
return corevol_att;
|
||||
}
|
||||
|
||||
@@ -182,12 +188,42 @@ void set_core_volume(int cmd)
|
||||
{
|
||||
vol_set_timeout = GetTimer(1000);
|
||||
|
||||
corevol_att &= 7;
|
||||
if (cmd < 0 && corevol_att < 6) corevol_att += 1;
|
||||
if (cmd > 0 && corevol_att > 0) corevol_att -= 1;
|
||||
if (has_boost)
|
||||
{
|
||||
int boost = corevol_att & 0x60;
|
||||
corevol_att &= 7;
|
||||
if (cmd < 0)
|
||||
{
|
||||
if (boost)
|
||||
{
|
||||
corevol_att = 0;
|
||||
boost -= 0x20;
|
||||
}
|
||||
else if (corevol_att < 6) corevol_att += 1;
|
||||
}
|
||||
|
||||
if (has_filter) setFilter();
|
||||
else send_volume();
|
||||
if (cmd > 0)
|
||||
{
|
||||
if (boost || !corevol_att)
|
||||
{
|
||||
boost += 0x20;
|
||||
if (boost > 0x40) boost = 0x40;
|
||||
}
|
||||
else if (corevol_att > 0) corevol_att -= 1;
|
||||
}
|
||||
|
||||
corevol_att |= boost;
|
||||
setFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
corevol_att &= 7;
|
||||
if (cmd < 0 && corevol_att < 6) corevol_att += 1;
|
||||
if (cmd > 0 && corevol_att > 0) corevol_att -= 1;
|
||||
|
||||
if (has_filter) setFilter();
|
||||
else send_volume();
|
||||
}
|
||||
}
|
||||
|
||||
void save_volume()
|
||||
|
||||
6
menu.cpp
6
menu.cpp
@@ -3984,10 +3984,12 @@ void HandleUI(void)
|
||||
{
|
||||
strcpy(s, " Core Volume: ");
|
||||
if (audio_filter_en() >= 0) s[4] = 0x1b;
|
||||
memset(s + strlen(s), 0, 10);
|
||||
memset(s + strlen(s), 0, 11);
|
||||
char *bar = s + strlen(s);
|
||||
memset(bar, 0x8C, 8);
|
||||
memset(bar, 0x7f, 8 - m);
|
||||
memset(bar, 0x7f, 8 - (m & 7));
|
||||
if (m & 0x60) bar[8] = '+';
|
||||
if (m & 0x40) bar[9] = '+';
|
||||
}
|
||||
OsdWrite(12, s, menusub == 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user