-added message about current song playing on song start/change,

it will fly in for 3 seconds and then fly out again
This commit is contained in:
fix94.1 2012-09-16 13:41:31 +00:00
parent 4f033e38a7
commit acb1e5a651
6 changed files with 49 additions and 4 deletions

View File

@ -489,7 +489,8 @@ void CMenu::cleanup()
{
if(cleaned_up)
return;
gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
//gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
m_btnMgr.hide(m_mainLblCurMusic);
_cleanupDefaultFont();
m_banner->DeleteBanner();
m_plugin.Cleanup();
@ -531,7 +532,7 @@ void CMenu::cleanup()
theme.soundSet.clear();
cleaned_up = true;
gprintf(" \nMemory cleaned up\n");
//gprintf(" \nMemory cleaned up\n");
gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
}
@ -1905,6 +1906,18 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
m_music.Tick(m_video_playing || (m_gameSelected &&
m_gameSound.IsLoaded()) || m_gameSound.IsPlaying());
if(m_music.SongChanged())
{
m_btnMgr.setText(m_mainLblCurMusic, m_music.GetFileName(), true);
m_btnMgr.show(m_mainLblCurMusic);
m_music.DisplayTime = time(NULL);
}
else if(m_music.DisplayTime > 0 && time(NULL) - m_music.DisplayTime > 3)
{
m_music.DisplayTime = 0;
m_btnMgr.hide(m_mainLblCurMusic);
}
//Take Screenshot
if(gc_btnsPressed & PAD_TRIGGER_Z)
{

View File

@ -147,8 +147,9 @@ private:
s16 m_mainBtnFavoritesOn;
s16 m_mainBtnFavoritesOff;
s16 m_mainLblLetter;
s16 m_mainLblCurMusic;
#ifdef SHOWMEM
u32 m_mem2FreeSize;
s16 m_mem2FreeSize;
#endif
#ifdef SHOWMEMGECKO
unsigned int mem1old;

View File

@ -918,6 +918,7 @@ void CMenu::_initMainMenu(CMenu::SThemeData &theme)
m_mainBtnFavoritesOff = _addPicButton(theme, "MAIN/FAVORITES_OFF", texFavOff, texFavOffS, 300, 400, 56, 56);
m_mainLblLetter = _addLabel(theme, "MAIN/LETTER", theme.titleFont, L"", 540, 40, 80, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblNotice = _addLabel(theme, "MAIN/NOTICE", theme.titleFont, L"", 340, 40, 280, 80, theme.titleFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblCurMusic = _addLabel(theme, "MAIN/MUSIC", theme.btnFont, L"", 0, 20, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
#ifdef SHOWMEM
m_mem2FreeSize = _addLabel(theme, "MEM2", theme.titleFont, L"", 40, 300, 480, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
#endif
@ -970,6 +971,7 @@ void CMenu::_initMainMenu(CMenu::SThemeData &theme)
_setHideAnim(m_mainLblInit, "MAIN/MESSAGE", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainLblLetter, "MAIN/LETTER", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainLblNotice, "MAIN/NOTICE", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainLblCurMusic, "MAIN/MUSIC", 0, -100, 0.f, 0.f);
#ifdef SHOWMEM
_setHideAnim(m_mem2FreeSize, "MEM2", 0, 0, 0.f, 0.f);
#endif

View File

@ -174,7 +174,7 @@ bool GuiSound::Load(const char * filepath)
fclose(f);
SoundHandler::Instance()->AddDecoder(this->voice, filepath);
gprintf("gui_sound.cpp: Loading %s using voice %d\n", filepath, this->voice);
//gprintf("gui_sound.cpp: Loading %s using voice %d\n", filepath, this->voice);
SoundDecoder * decoder = SoundHandler::Instance()->Decoder(this->voice);
if(!decoder)
{

View File

@ -17,11 +17,15 @@ void MusicPlayer::cleanup()
MusicFile.Stop();
MusicFile.FreeMemory();
m_music_files.clear();
DisplayTime = 0;
m_changed = false;
m_stopped = true;
}
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
{
DisplayTime = 0;
m_changed = false;
m_stopped = true;
CurrentPosition = 0;
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
@ -151,6 +155,25 @@ void MusicPlayer::Tick(bool attenuate)
void MusicPlayer::LoadCurrentFile()
{
m_changed = true;
MusicFile.Load((*m_current_music).c_str());
Play();
}
/* For our GUI */
wstringEx MusicPlayer::GetFileName()
{
wstringEx CurrentFile;
string CurrentFileStr((*m_current_music).begin()+(*m_current_music).find_last_of('/')+1,
(*m_current_music).begin()+(*m_current_music).find_last_of('.'));
CurrentFile.fromUTF8(CurrentFileStr.c_str());
return CurrentFile;
}
bool MusicPlayer::SongChanged()
{
if(!m_changed)
return false;
m_changed = false;
return true;
}

View File

@ -4,6 +4,7 @@
#include <string>
#include "gui_sound.h"
#include "config/config.hpp"
#include "wstringEx/wstringEx.hpp"
using namespace std;
@ -25,6 +26,10 @@ public:
bool IsStopped() { return m_stopped; };
/* For our GUI */
wstringEx GetFileName();
bool SongChanged();
time_t DisplayTime;
protected:
void Play();
void Stop();
@ -37,6 +42,7 @@ protected:
u8 m_fade_rate;
int CurrentPosition;
bool m_stopped;
bool m_changed;
GuiSound MusicFile;
vector<string> m_music_files;