- vfd/audioplayer: fix vfd progress in audioplayer

don't update full vfd every second
This commit is contained in:
svenhoefer
2015-01-09 11:18:52 +01:00
parent 9f7d26a646
commit 90f968c19d
3 changed files with 15 additions and 28 deletions

View File

@@ -446,7 +446,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
{
if(!has_lcd) return;
if (((mode == MODE_TVRADIO) || (mode == MODE_MENU_UTF8)) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) {
if (((mode == MODE_TVRADIO) || (mode == MODE_AUDIO) || (mode == MODE_MENU_UTF8)) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) {
//if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0)
{
ShowIcon(FP_ICON_FRAME, true);
@@ -503,6 +503,8 @@ printf("CVFD::showAudioTrack: %s\n", title.c_str());
void CVFD::showAudioPlayMode(AUDIOMODES m)
{
if(fd < 0) return;
if (mode != MODE_AUDIO)
return;
switch(m) {
case AUDIO_MODE_PLAY:
@@ -525,22 +527,13 @@ void CVFD::showAudioPlayMode(AUDIOMODES m)
wake_up();
}
void CVFD::showAudioProgress(const char /*perc*/, bool /*isMuted*/)
void CVFD::showAudioProgress(const unsigned char perc)
{
if(!has_lcd) return;
#if 0 // what is this ? FIXME
if (mode == MODE_AUDIO) {
int dp = int( perc/100.0*61.0+12.0);
if(isMuted) {
if(dp > 12) {
display.draw_line(12, 56, dp-1, 56, CLCDDisplay::PIXEL_OFF);
display.draw_line(12, 58, dp-1, 58, CLCDDisplay::PIXEL_OFF);
}
else
display.draw_line (12,55,72,59, CLCDDisplay::PIXEL_ON);
}
}
#endif
if(fd < 0) return;
if (mode != MODE_AUDIO)
return;
showPercentOver(perc, false);
}
void CVFD::setMode(const MODES m, const char * const title)

View File

@@ -128,7 +128,7 @@ class CVFD
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);
void showAudioPlayMode(AUDIOMODES m=AUDIO_MODE_PLAY);
void showAudioProgress(const char perc, bool isMuted);
void showAudioProgress(const unsigned char perc);
void setBrightness(int);
int getBrightness();

View File

@@ -837,7 +837,7 @@ int CAudioPlayerGui::show()
ret = menu_return::RETURN_EXIT_ALL;
loop = false;
}
paintLCD();
//paintLCD();
}
}
hide();
@@ -2162,9 +2162,9 @@ void CAudioPlayerGui::updateTimes(const bool force)
}
}
}
if ((updatePlayed || updateTotal) && m_time_total != 0)
if ((updatePlayed || updateTotal) && m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0)
{
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted());
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total);
}
}
}
@@ -2175,20 +2175,14 @@ void CAudioPlayerGui::paintLCD()
{
case CAudioPlayerGui::STOP:
CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_STOP);
CVFD::getInstance()->showAudioProgress(0, CNeutrinoApp::getInstance()->isMuted());
CVFD::getInstance()->showAudioProgress(0);
break;
case CAudioPlayerGui::PLAY:
CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PLAY);
CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title,
m_curr_audiofile.MetaData.album);
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0)
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted());
#ifdef INCLUDE_UNUSED_STUFF
else
CVFD::getInstance()->showAudioProgress(100 * CAudioPlayer::getInstance()->getScBuffered() / 65536, CNeutrinoApp::getInstance()->isMuted());
#endif /* INCLUDE_UNUSED_STUFF */
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total);
break;
case CAudioPlayerGui::PAUSE:
CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PAUSE);