mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 03:11:58 +01:00
-added music resume after ios reload/enabling nand emulator
This commit is contained in:
parent
9140b17315
commit
f527735c54
@ -91,7 +91,7 @@ bool loadIOS(int ios, bool MountDevices)
|
|||||||
{
|
{
|
||||||
WDVD_Close();
|
WDVD_Close();
|
||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
m_music.Stop();
|
m_music.StopAndSetPos();
|
||||||
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
||||||
ShutdownBeforeExit();
|
ShutdownBeforeExit();
|
||||||
ret = IOS_ReloadIOS(ios) == 0;
|
ret = IOS_ReloadIOS(ios) == 0;
|
||||||
|
@ -2140,7 +2140,10 @@ bool CMenu::_loadChannelList(void)
|
|||||||
Nand::Instance()->Disable_Emu();
|
Nand::Instance()->Disable_Emu();
|
||||||
if(!disable_emu)
|
if(!disable_emu)
|
||||||
{
|
{
|
||||||
_TempLoadIOS();
|
if(useMainIOS)
|
||||||
|
m_music.StopAndSetPos();
|
||||||
|
else
|
||||||
|
_TempLoadIOS();
|
||||||
if(!DeviceHandler::Instance()->IsInserted(lastPartition))
|
if(!DeviceHandler::Instance()->IsInserted(lastPartition))
|
||||||
DeviceHandler::Instance()->Mount(lastPartition);
|
DeviceHandler::Instance()->Mount(lastPartition);
|
||||||
|
|
||||||
|
@ -127,6 +127,16 @@ int OggDecoder::Rewind()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int OggDecoder::Tell()
|
||||||
|
{
|
||||||
|
return ov_raw_tell(&ogg_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
int OggDecoder::Seek(int pos)
|
||||||
|
{
|
||||||
|
return ov_raw_seek(&ogg_file, pos);
|
||||||
|
}
|
||||||
|
|
||||||
int OggDecoder::Read(u8 * buffer, int buffer_size, int)
|
int OggDecoder::Read(u8 * buffer, int buffer_size, int)
|
||||||
{
|
{
|
||||||
if(!file_fd)
|
if(!file_fd)
|
||||||
|
@ -38,6 +38,8 @@ public:
|
|||||||
int GetSampleRate();
|
int GetSampleRate();
|
||||||
int Rewind();
|
int Rewind();
|
||||||
int Read(u8 * buffer, int buffer_size, int pos);
|
int Read(u8 * buffer, int buffer_size, int pos);
|
||||||
|
int Tell();
|
||||||
|
int Seek(int pos);
|
||||||
protected:
|
protected:
|
||||||
void OpenFile();
|
void OpenFile();
|
||||||
OggVorbis_File ogg_file;
|
OggVorbis_File ogg_file;
|
||||||
|
@ -83,6 +83,8 @@ public:
|
|||||||
void SetLoop(u8 l);
|
void SetLoop(u8 l);
|
||||||
//!Needed for music etc
|
//!Needed for music etc
|
||||||
void SetVoice(s8 v);
|
void SetVoice(s8 v);
|
||||||
|
//!Needed for music :P
|
||||||
|
s8 GetVoice() { return voice; }
|
||||||
private:
|
private:
|
||||||
//!Initializes the GuiSound object by setting the default values
|
//!Initializes the GuiSound object by setting the default values
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "musicplayer.h"
|
#include "musicplayer.h"
|
||||||
|
#include "SoundHandler.hpp"
|
||||||
#include "fileOps/fileOps.h"
|
#include "fileOps/fileOps.h"
|
||||||
#include "gui/text.hpp"
|
#include "gui/text.hpp"
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ void MusicPlayer::cleanup()
|
|||||||
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
|
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
|
||||||
{
|
{
|
||||||
m_stopped = true;
|
m_stopped = true;
|
||||||
|
CurrentPosition = 0;
|
||||||
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
|
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
|
||||||
m_music_volume = cfg.getInt("GENERAL", "sound_volume_music", 255);
|
m_music_volume = cfg.getInt("GENERAL", "sound_volume_music", 255);
|
||||||
|
|
||||||
@ -78,7 +80,15 @@ void MusicPlayer::Next()
|
|||||||
{
|
{
|
||||||
if(m_music_files.empty())
|
if(m_music_files.empty())
|
||||||
return;
|
return;
|
||||||
|
if(CurrentPosition)
|
||||||
|
{
|
||||||
|
LoadCurrentFile();
|
||||||
|
MusicFile.Pause();
|
||||||
|
SoundHandler::Instance()->Decoder(MusicFile.GetVoice())->Seek(CurrentPosition);
|
||||||
|
CurrentPosition = 0;
|
||||||
|
MusicFile.Resume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_current_music++;
|
m_current_music++;
|
||||||
if (m_current_music == m_music_files.end())
|
if (m_current_music == m_music_files.end())
|
||||||
m_current_music = m_music_files.begin();
|
m_current_music = m_music_files.begin();
|
||||||
@ -86,6 +96,12 @@ void MusicPlayer::Next()
|
|||||||
LoadCurrentFile();
|
LoadCurrentFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MusicPlayer::StopAndSetPos()
|
||||||
|
{
|
||||||
|
CurrentPosition = SoundHandler::Instance()->Decoder(MusicFile.GetVoice())->Tell();
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
void MusicPlayer::Play()
|
void MusicPlayer::Play()
|
||||||
{
|
{
|
||||||
SetVolume(m_music_current_volume);
|
SetVolume(m_music_current_volume);
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
void Next();
|
void Next();
|
||||||
void Play();
|
void Play();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
void StopAndSetPos();
|
||||||
|
|
||||||
bool IsStopped() { return m_stopped; };
|
bool IsStopped() { return m_stopped; };
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ protected:
|
|||||||
u8 m_music_volume;
|
u8 m_music_volume;
|
||||||
u8 m_music_current_volume;
|
u8 m_music_current_volume;
|
||||||
u8 m_fade_rate;
|
u8 m_fade_rate;
|
||||||
|
int CurrentPosition;
|
||||||
bool m_stopped;
|
bool m_stopped;
|
||||||
|
|
||||||
GuiSound MusicFile;
|
GuiSound MusicFile;
|
||||||
|
Loading…
Reference in New Issue
Block a user