mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-24 04:09:15 +01:00
-hopefully fixed bg music the last time
This commit is contained in:
parent
7c78369dcf
commit
e62dcd8a09
@ -30,7 +30,6 @@
|
||||
#include "wiiuse/wpad.h"
|
||||
|
||||
#include "WiiMovie.hpp"
|
||||
#include "musicplayer.h"
|
||||
#include "gecko.h"
|
||||
#include "mem2.hpp"
|
||||
|
||||
@ -98,8 +97,6 @@ WiiMovie::~WiiMovie()
|
||||
LWP_MutexDestroy(mutex);
|
||||
|
||||
ASND_StopVoice(10);
|
||||
MusicPlayer::Instance()->Play();
|
||||
|
||||
if (ReadThread != LWP_THREAD_NULL)
|
||||
{
|
||||
LWP_ResumeThread(ReadThread);
|
||||
|
@ -143,6 +143,7 @@ CMenu::CMenu(CVideo &vid) :
|
||||
m_current_view = COVERFLOW_USB;
|
||||
m_Emulator_boot = false;
|
||||
m_banner = new BannerWindow;
|
||||
m_music = new MusicPlayer;
|
||||
}
|
||||
|
||||
void CMenu::init(void)
|
||||
@ -419,7 +420,7 @@ void CMenu::init(void)
|
||||
}
|
||||
|
||||
m_btnMgr.init(m_vid);
|
||||
MusicPlayer::Instance()->Init(m_cfg, m_musicDir, sfmt("%s/music", m_themeDataDir.c_str()));
|
||||
m_music->Init(m_cfg, m_musicDir, sfmt("%s/music", m_themeDataDir.c_str()));
|
||||
|
||||
_buildMenus();
|
||||
|
||||
@ -488,7 +489,7 @@ void CMenu::cleanup(bool ios_reload)
|
||||
if (!ios_reload)
|
||||
m_cameraSound.release();
|
||||
|
||||
MusicPlayer::DestroyInstance();
|
||||
m_music->cleanup();
|
||||
SoundHandler::DestroyInstance();
|
||||
soundDeinit();
|
||||
|
||||
@ -1787,7 +1788,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
|
||||
Sys_Test();
|
||||
}
|
||||
|
||||
if(withCF && m_gameSelected && m_gamesound_changed && (m_gameSoundHdr == NULL) && !m_gameSound.IsPlaying() && MusicPlayer::Instance()->GetVolume() == 0)
|
||||
if(withCF && m_gameSelected && m_gamesound_changed && (m_gameSoundHdr == NULL) && !m_gameSound.IsPlaying() && m_music->GetVolume() == 0)
|
||||
{
|
||||
CheckGameSoundThread();
|
||||
m_gameSound.Play(m_bnrSndVol);
|
||||
@ -1796,7 +1797,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
|
||||
else if(!m_gameSelected)
|
||||
m_gameSound.Stop();
|
||||
|
||||
MusicPlayer::Instance()->Tick(m_video_playing || (m_gameSelected &&
|
||||
m_music->Tick(m_video_playing || (m_gameSelected &&
|
||||
m_gameSound.IsLoaded()) || m_gameSound.IsPlaying());
|
||||
|
||||
//Take Screenshot
|
||||
@ -2217,11 +2218,11 @@ void CMenu::_stopSounds(void)
|
||||
// Fade out sounds
|
||||
int fade_rate = m_cfg.getInt("GENERAL", "music_fade_rate", 8);
|
||||
|
||||
if(!MusicPlayer::Instance()->IsStopped())
|
||||
if(!m_music->IsStopped())
|
||||
{
|
||||
while(MusicPlayer::Instance()->GetVolume() > 0 || m_gameSound.GetVolume() > 0)
|
||||
while(m_music->GetVolume() > 0 || m_gameSound.GetVolume() > 0)
|
||||
{
|
||||
MusicPlayer::Instance()->Tick(true);
|
||||
m_music->Tick(true);
|
||||
if(m_gameSound.GetVolume() > 0)
|
||||
m_gameSound.SetVolume(m_gameSound.GetVolume() < fade_rate ? 0 : m_gameSound.GetVolume() - fade_rate);
|
||||
VIDEO_WaitVSync();
|
||||
@ -2230,7 +2231,7 @@ void CMenu::_stopSounds(void)
|
||||
m_btnMgr.stopSounds();
|
||||
m_cf.stopSound();
|
||||
|
||||
MusicPlayer::Instance()->Stop();
|
||||
m_music->Stop();
|
||||
m_gameSound.Stop();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
CVideo &m_vid;
|
||||
CCursor m_cursor[WPAD_MAX_WIIMOTES];
|
||||
CButtonsMgr m_btnMgr;
|
||||
|
||||
MusicPlayer *m_music;
|
||||
CCoverFlow m_cf;
|
||||
CFanart m_fa;
|
||||
CachedList<dir_discHdr> m_gameList;
|
||||
|
@ -101,14 +101,14 @@ int CMenu::_configSnd(void)
|
||||
int musicVol = min(m_cfg.getInt("GENERAL", "sound_volume_music", 255) + step, 255);
|
||||
m_cfg.setInt("GENERAL", "sound_volume_music", musicVol);
|
||||
_showConfigSnd();
|
||||
MusicPlayer::Instance()->SetVolume(MusicPlayer::Instance()->GetVolume(), musicVol);
|
||||
m_music->SetVolume(m_music->GetVolume(), musicVol);
|
||||
}
|
||||
else if (m_btnMgr.selected(m_configSndBtnMusicVolM))
|
||||
{
|
||||
int musicVol = max(m_cfg.getInt("GENERAL", "sound_volume_music", 255) - step, 0);
|
||||
m_cfg.setInt("GENERAL", "sound_volume_music", musicVol);
|
||||
_showConfigSnd();
|
||||
MusicPlayer::Instance()->SetVolume(MusicPlayer::Instance()->GetVolume(), musicVol);
|
||||
m_music->SetVolume(m_music->GetVolume(), musicVol);
|
||||
}
|
||||
else if (m_btnMgr.selected(m_configSndBtnCFVolP))
|
||||
{
|
||||
|
@ -461,6 +461,7 @@ void CMenu::_game(bool launch)
|
||||
}
|
||||
movie.Stop();
|
||||
_showGame();
|
||||
m_music->Play();
|
||||
m_video_playing = false;
|
||||
//m_gameSound.play(m_bnrSndVol);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ int CMenu::main(void)
|
||||
_initAsyncNetwork();
|
||||
|
||||
SetupInput(true);
|
||||
MusicPlayer::Instance()->Play();
|
||||
m_music->Play();
|
||||
|
||||
GameTDB m_gametdb;
|
||||
m_gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
|
||||
@ -543,14 +543,14 @@ int CMenu::main(void)
|
||||
else if(BTN_MINUS_PRESSED)
|
||||
{
|
||||
if(b_lr_mode)
|
||||
MusicPlayer::Instance()->Previous();
|
||||
m_music->Previous();
|
||||
else
|
||||
m_cf.pageUp();
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
{
|
||||
if(b_lr_mode)
|
||||
MusicPlayer::Instance()->Next();
|
||||
m_music->Next();
|
||||
else
|
||||
m_cf.pageDown();
|
||||
}
|
||||
@ -593,7 +593,7 @@ int CMenu::main(void)
|
||||
if(b_lr_mode)
|
||||
m_cf.pageUp();
|
||||
else
|
||||
MusicPlayer::Instance()->Previous();
|
||||
m_music->Previous();
|
||||
}
|
||||
else if(BTN_RIGHT_PRESSED)
|
||||
{
|
||||
@ -601,7 +601,7 @@ int CMenu::main(void)
|
||||
if(b_lr_mode)
|
||||
m_cf.pageDown();
|
||||
else
|
||||
MusicPlayer::Instance()->Next();
|
||||
m_music->Next();
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED && !m_locked)
|
||||
{
|
||||
|
@ -432,7 +432,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
m_thrdMessageAdded = false;
|
||||
m_cf.stopCoverLoader();
|
||||
_stopSounds();
|
||||
MusicPlayer::DestroyInstance();
|
||||
m_music->cleanup();
|
||||
SoundHandler::DestroyInstance();
|
||||
soundDeinit();
|
||||
Nand::Instance()->Disable_Emu();
|
||||
|
@ -2,27 +2,22 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
MusicPlayer *MusicPlayer::instance = NULL;
|
||||
|
||||
MusicPlayer *MusicPlayer::Instance()
|
||||
MusicPlayer::MusicPlayer()
|
||||
{
|
||||
if (instance == NULL)
|
||||
instance = new MusicPlayer();
|
||||
|
||||
return instance;
|
||||
m_music = NULL;
|
||||
}
|
||||
|
||||
void MusicPlayer::DestroyInstance()
|
||||
void MusicPlayer::cleanup()
|
||||
{
|
||||
if (instance != NULL)
|
||||
delete instance;
|
||||
|
||||
instance = NULL;
|
||||
if (m_music != NULL)
|
||||
{
|
||||
m_music->Stop();
|
||||
delete m_music;
|
||||
}
|
||||
}
|
||||
|
||||
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
|
||||
{
|
||||
m_music = NULL;
|
||||
m_manual_stop = true;
|
||||
m_stopped = true;
|
||||
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
|
||||
|
@ -18,9 +18,8 @@ enum MusicDirectory
|
||||
class MusicPlayer
|
||||
{
|
||||
public:
|
||||
static MusicPlayer *Instance();
|
||||
static void DestroyInstance();
|
||||
|
||||
MusicPlayer();
|
||||
void cleanup();
|
||||
void Init(Config &cfg, std::string musicDir, std::string themeMusicDir);
|
||||
void Tick(bool attenuate);
|
||||
|
||||
@ -39,8 +38,6 @@ public:
|
||||
private:
|
||||
~MusicPlayer();
|
||||
|
||||
static MusicPlayer *instance;
|
||||
|
||||
void LoadCurrentFile();
|
||||
|
||||
CachedList<std::string> m_music_files;
|
||||
|
Loading…
Reference in New Issue
Block a user