From 373807b158af524710ddbee3e074939eccecfc85 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 5 Nov 2021 21:11:08 +0100 Subject: [PATCH] some cec volume fixes Conflicts: src/neutrino.cpp --- src/gui/cec_setup.cpp | 1 + src/gui/lua/lua_misc.cpp | 1 + src/neutrino.cpp | 13 ++++++------- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/cec_setup.cpp b/src/gui/cec_setup.cpp index 6f02dae18..3775c206d 100644 --- a/src/gui/cec_setup.cpp +++ b/src/gui/cec_setup.cpp @@ -162,6 +162,7 @@ bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/ #if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE if (g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF) { + g_settings.current_volume = 100; videoDecoder->SetAudioDestination(g_settings.hdmi_cec_volume); } #endif diff --git a/src/gui/lua/lua_misc.cpp b/src/gui/lua/lua_misc.cpp index eb97c5967..95dbb1569 100644 --- a/src/gui/lua/lua_misc.cpp +++ b/src/gui/lua/lua_misc.cpp @@ -197,6 +197,7 @@ int CLuaInstMisc::enableMuteIcon(lua_State *L) int CLuaInstMisc::setVolume(lua_State *L) { + if (g_settings.hdmi_cec_volume) return 0; CLuaMisc *D = MiscCheckData(L, 1); if (!D) return 0; lua_Integer vol = luaL_checkint(L, 2); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1a5ca9f6a..0693adafa 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -475,9 +475,9 @@ int CNeutrinoApp::loadSetup(const char *fname) #endif // volume - g_settings.current_volume = configfile.getInt32("current_volume", 100); - g_settings.current_volume_step = configfile.getInt32("current_volume_step", 2); - g_settings.start_volume = configfile.getInt32("start_volume", -1); + g_settings.current_volume = g_settings.hdmi_cec_volume ? 100 : configfile.getInt32("current_volume", 100); + g_settings.current_volume_step = configfile.getInt32("current_volume_step", 5); + g_settings.start_volume = g_settings.hdmi_cec_volume ? 100 : configfile.getInt32("start_volume", -1); if (g_settings.start_volume >= 0) g_settings.current_volume = g_settings.hdmi_cec_volume ? 100 : g_settings.start_volume; g_settings.audio_volume_percent_ac3 = configfile.getInt32("audio_volume_percent_ac3", 100); @@ -1657,10 +1657,9 @@ void CNeutrinoApp::saveSetup(const char *fname) #endif // volume - if (!g_settings.hdmi_cec_volume) - configfile.setInt32("current_volume", g_settings.current_volume); + configfile.setInt32( "current_volume", g_settings.hdmi_cec_volume ? 100 : g_settings.current_volume ); configfile.setInt32("current_volume_step", g_settings.current_volume_step); - configfile.setInt32("start_volume", g_settings.start_volume); + configfile.setInt32( "start_volume", g_settings.hdmi_cec_volume ? 100 : g_settings.start_volume ); configfile.setInt32("audio_volume_percent_ac3", g_settings.audio_volume_percent_ac3); configfile.setInt32("audio_volume_percent_pcm", g_settings.audio_volume_percent_pcm); @@ -3057,7 +3056,7 @@ TIMER_START(); ZapStart_arg.ci_delay = g_settings.ci_delay; memcpy(ZapStart_arg.ci_rpr, g_settings.ci_rpr, sizeof(g_settings.ci_rpr)); #endif - ZapStart_arg.volume = g_settings.hdmi_cec_volume ? 100 : g_settings.current_volume; + ZapStart_arg.volume = g_settings.current_volume; ZapStart_arg.webtv_xml = &g_settings.webtv_xml; ZapStart_arg.webradio_xml = &g_settings.webradio_xml;