diff --git a/audio.cpp b/audio.cpp index 0f9dc0d..5fbe716 100644 --- a/audio.cpp +++ b/audio.cpp @@ -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; diff --git a/input.cpp b/input.cpp index 1dd9dd1..9646c7a 100644 --- a/input.cpp +++ b/input.cpp @@ -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]); + } } }