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