From fa4422fc2ec63c429c3b9ef140fb2da9ad6edb8e Mon Sep 17 00:00:00 2001 From: sorgelig Date: Thu, 21 Jun 2018 04:53:58 +0800 Subject: [PATCH] INI option to enable volume control. --- MiSTer.ini | 2 ++ cfg.cpp | 1 + cfg.h | 1 + user_io.cpp | 3 +++ 4 files changed, 7 insertions(+) diff --git a/MiSTer.ini b/MiSTer.ini index 425dba2..749158b 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -6,7 +6,9 @@ composite_sync=0 ; set to 1 for composite sync on HSync signal of VGA outp vga_scaler=0 ; set to 1 to connect VGA to scaler output. hdmi_audio_96k=0 ; set to 1 for 96khz/16bit HDMI audio (48khz/16bit otherwise) keyrah_mode=0x18d80002 ; VIDPID of keyrah for special code translation (0x23418037 for Arduino Micro) +volumectl=1 ; enable audio volume control by multimedia keys ;bootscreen=0 ; uncomment to disable boot screen of some cores like Minimig. +;mouse_throttle=10 ; 1-100 mouse speed divisor. Useful for very sensitive mouses ; USER button emulation by keybaord. Usually it's reset button. ; 0 - lctrl+lalt+ralt (lctrl+lgui+rgui on keyrah) diff --git a/cfg.cpp b/cfg.cpp index 2e4bb23..a9b795c 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -39,6 +39,7 @@ const ini_var_t ini_vars[] = { { "KBD_NOMOUSE", (void*)(&(cfg.kbd_nomouse)), UINT8, 0, 1, 1 }, { "MOUSE_THROTTLE", (void*)(&(cfg.mouse_throttle)), UINT8, 1, 100, 1 }, { "BOOTSCREEN", (void*)(&(cfg.bootscreen)), UINT8, 0, 1, 1 }, + { "VOLUMECTL", (void*)(&(cfg.volumectl)), UINT8, 0, 1, 1 }, }; // mist ini config diff --git a/cfg.h b/cfg.h index 90b4571..3165141 100644 --- a/cfg.h +++ b/cfg.h @@ -28,6 +28,7 @@ typedef struct { uint8_t kbd_nomouse; uint8_t mouse_throttle; uint8_t bootscreen; + uint8_t volumectl; char video_conf[1024]; } cfg_t; diff --git a/user_io.cpp b/user_io.cpp index f704744..4902c5e 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -424,6 +424,7 @@ void user_io_init(const char *path) parse_video_mode(); FileLoadConfig("Volume.dat", &vol_att, 1); vol_att &= 0x1F; + if (!cfg.volumectl) vol_att = 0; spi_uio_cmd8(UIO_AUDVOL, vol_att); user_io_send_buttons(1); @@ -1896,6 +1897,8 @@ void user_io_osd_key_enable(char on) static void set_volume(int cmd) { + if (!cfg.volumectl) return; + vol_set_timeout = GetTimer(1000); vol_att &= 0x17;