Add MiSTer_cmd command: volume mute/unmute/0-7.

This commit is contained in:
Sorgelig
2022-10-31 23:05:20 +08:00
parent 6bda023db8
commit 631276d59d
2 changed files with 10 additions and 1 deletions

View File

@@ -150,7 +150,9 @@ void set_volume(int cmd)
vol_set_timeout = GetTimer(1000);
vol_att &= 0x17;
if (!cmd) vol_att ^= 0x10;
if ((cmd & 0xC0) == 0x80) vol_att = (vol_att & 0x7) | ((cmd & 1) << 4);
else if ((cmd & 0xC0) == 0x40) vol_att = (vol_att & 0x10) | (~cmd & 7);
else if (!cmd) vol_att ^= 0x10;
else if (vol_att & 0x10) vol_att &= 0xF;
else if (cmd < 0 && vol_att < 7) vol_att += 1;
else if (cmd > 0 && vol_att > 0) vol_att -= 1;

View File

@@ -25,6 +25,7 @@
#include "fpga_io.h"
#include "osd.h"
#include "video.h"
#include "audio.h"
#include "joymapping.h"
#include "support.h"
#include "profiling.h"
@@ -5164,6 +5165,12 @@ int input_test(int getchar)
{
user_io_screenshot_cmd(cmd);
}
else if (!strncmp(cmd, "volume ", 7))
{
if (!strcmp(cmd + 7, "mute")) set_volume(0x81);
else if (!strcmp(cmd + 7, "unmute")) set_volume(0x80);
else if (cmd[7] >= '0' && cmd[7] <= '7') set_volume(0x40 - 0x30 + cmd[7]);
}
}
}