diff --git a/src/driver/lcdd.cpp b/src/driver/lcdd.cpp index d6712a7ad..dfd03882e 100644 --- a/src/driver/lcdd.cpp +++ b/src/driver/lcdd.cpp @@ -660,7 +660,8 @@ void CLCD::showRCLock(int duration) void CLCD::showVolume(const char vol, const bool perform_update) { - volume = vol; + setVolume(vol); + if ( ((mode == MODE_TVRADIO) && (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) || ((mode == MODE_MOVIE) && (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) || @@ -694,6 +695,14 @@ void CLCD::showVolume(const char vol, const bool perform_update) wake_up(); } +void CLCD::setVolume(const char vol) +{ + if (vol == volume) + return; + + volume = vol; +} + void CLCD::showPercentOver(const unsigned char perc, const bool perform_update, const MODES m) { if (mode != m) diff --git a/src/driver/lcdd.h b/src/driver/lcdd.h index 71eb59d3c..c4a0881c8 100644 --- a/src/driver/lcdd.h +++ b/src/driver/lcdd.h @@ -191,6 +191,7 @@ class CLCD /** blocks for duration seconds */ void showRCLock(int duration = 2); void showVolume(const char vol, const bool perform_update = true); + void setVolume(const char vol); void showPercentOver(const unsigned char perc, const bool perform_update = true, const MODES m = MODE_TVRADIO); void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false); void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album); diff --git a/src/driver/simple_display.cpp b/src/driver/simple_display.cpp index 3e3f686e6..c61f35842 100644 --- a/src/driver/simple_display.cpp +++ b/src/driver/simple_display.cpp @@ -395,14 +395,11 @@ void CLCD::showVolume(const char vol, const bool update) const int type = (g_info.hw_caps->display_xres < 5) + (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM); const char *vol_fmt[] = { "Vol:%3d%%", "%4d", "%4d" }; const char *mutestr[] = { "Vol:MUTE", "mute", " -0-"}; + if (vol == volume && update) return; - volume = vol; - /* char is unsigned, so vol is never < 0 */ - if (volume > 100) - volume = 100; - ShowIcon(FP_ICON_MUTE, muted); + setVolume(vol); if (muted) { @@ -420,10 +417,22 @@ void CLCD::showVolume(const char vol, const bool update) } ShowText(s); + vol_active = true; #if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE wake_up(); #endif - vol_active = true; +} + +void CLCD::setVolume(const char vol) +{ + if (vol == volume) + return; + + volume = vol; + + /* char is unsigned, so volume is never < 0 */ + if (volume > 100) + volume = 100; } void CLCD::showPercentOver(const unsigned char /*perc*/, const bool /*perform_update*/, const MODES) @@ -662,7 +671,13 @@ void CLCD::setMuted(bool mu) { printf("CLCD::%s %d\n", __func__, mu); muted = mu; - showVolume(volume, false); + if (muted) + showVolume(volume, false); + ShowIcon(FP_ICON_MUTE, muted); + +#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE + wake_up(); +#endif } void CLCD::resume() diff --git a/src/driver/simple_display.h b/src/driver/simple_display.h index 5714380b6..595365099 100644 --- a/src/driver/simple_display.h +++ b/src/driver/simple_display.h @@ -175,6 +175,7 @@ class CLCD /** blocks for duration seconds */ void showRCLock(int duration = 2); void showVolume(const char vol, const bool perform_update = true); + void setVolume(const char vol); void showPercentOver(const unsigned char perc, const bool perform_update = true, const MODES m = MODE_TVRADIO); void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false); void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album); diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 5af4f7825..159941f7c 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -421,11 +421,10 @@ void CVFD::showVolume(const char vol, const bool force_update) static int oldpp = 0; if(!has_lcd) return; - ShowIcon(FP_ICON_MUTE, muted); - - if(!force_update && vol == volume) + if (vol == volume && !force_update) return; - volume = vol; + + setVolume(vol); if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 2 /* off */) return; @@ -457,6 +456,18 @@ printf("CVFD::showVolume: %d, bar %d\n", (int) vol, pp); } } +void CVFD::setVolume(const char vol) +{ + if (vol == volume) + return; + + volume = vol; + + /* char is unsigned, so volume is never < 0 */ + if (volume > 100) + volume = 100; +} + void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update*/, const MODES origin) { @@ -741,7 +752,9 @@ void CVFD::setMuted(bool mu) { if(!has_lcd) return; muted = mu; - showVolume(volume); + if (muted) + showVolume(volume); + ShowIcon(FP_ICON_MUTE, muted); } void CVFD::resume() diff --git a/src/driver/vfd.h b/src/driver/vfd.h index 2a6eefbfb..2ea9f4422 100644 --- a/src/driver/vfd.h +++ b/src/driver/vfd.h @@ -125,6 +125,7 @@ class CVFD /** blocks for duration seconds */ void showRCLock(int duration = 2); void showVolume(const char vol, const bool perform_update = true); + void setVolume(const char vol); void showPercentOver(const unsigned char perc, const bool perform_update = true, const MODES origin = MODE_TVRADIO); void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false); void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 561e96b80..25c3bde7d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3206,8 +3206,12 @@ TIMER_START(); g_audioMute->AudioMute(current_muted, true); CZapit::getInstance()->SetVolumePercent(g_settings.audio_volume_percent_ac3, g_settings.audio_volume_percent_pcm); - CVFD::getInstance()->showVolume(g_settings.current_volume); CVFD::getInstance()->setMuted(current_muted); + if (g_info.hw_caps->display_has_statusline) + CVFD::getInstance()->showVolume(g_settings.current_volume, false); + else + CVFD::getInstance()->setVolume(g_settings.current_volume); + #ifdef ENABLE_GRAPHLCD if (current_muted) @@ -5153,7 +5157,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setBacklight(g_settings.backlight_tv); - CVFD::getInstance()->showVolume(g_settings.current_volume, true); + if (g_info.hw_caps->display_has_statusline) + CVFD::getInstance()->showVolume(g_settings.current_volume, false); CZapit::getInstance()->EnablePlayback(true); g_Zapit->setStandby(false);