|
|
|
@ -353,6 +353,17 @@ void CMusicPlayer::play (sint index)
|
|
|
|
|
if(!SoundMngr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (_Songs.empty())
|
|
|
|
|
{
|
|
|
|
|
index = 0;
|
|
|
|
|
createPlaylistFromMusic();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_Songs.empty())
|
|
|
|
|
{
|
|
|
|
|
_State = Stopped;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sint prevSongIndex = _CurrentSongIndex;
|
|
|
|
|
|
|
|
|
@ -465,7 +476,10 @@ void CMusicPlayer::next ()
|
|
|
|
|
void CMusicPlayer::update ()
|
|
|
|
|
{
|
|
|
|
|
if(!SoundMngr)
|
|
|
|
|
{
|
|
|
|
|
_State = Stopped;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MusicPlayerWorker.isRunning() || !_SongUpdateQueue.empty())
|
|
|
|
|
{
|
|
|
|
@ -564,22 +578,7 @@ static void addFromPlaylist(const std::string &playlist, const std::vector<std::
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
class CMusicPlayerPlaySongs: public IActionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void execute(CCtrlBase * /* pCaller */, const string &Params)
|
|
|
|
|
{
|
|
|
|
|
if(!SoundMngr)
|
|
|
|
|
{
|
|
|
|
|
// Do not show warning on volume change as its restored at startup
|
|
|
|
|
if (Params.find("volume") == std::string::npos)
|
|
|
|
|
CInterfaceManager::getInstance()->messageBox (CI18N::get ("uiMP3SoundDisabled"));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Params == "play_songs")
|
|
|
|
|
void CMusicPlayer::createPlaylistFromMusic()
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> extensions;
|
|
|
|
|
SoundMngr->getMixer()->getMusicExtensions(extensions);
|
|
|
|
@ -633,7 +632,27 @@ public:
|
|
|
|
|
// Sort songs by filename
|
|
|
|
|
sort(filenames.begin(), filenames.end());
|
|
|
|
|
|
|
|
|
|
MusicPlayer.playSongs(filenames);
|
|
|
|
|
playSongs(filenames);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
class CMusicPlayerPlaySongs: public IActionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void execute(CCtrlBase * /* pCaller */, const string &Params)
|
|
|
|
|
{
|
|
|
|
|
if(!SoundMngr)
|
|
|
|
|
{
|
|
|
|
|
// Do not show warning on volume change as its restored at startup
|
|
|
|
|
if (Params.find("volume") == std::string::npos)
|
|
|
|
|
CInterfaceManager::getInstance()->messageBox (CI18N::get ("uiMP3SoundDisabled"));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Params == "play_songs")
|
|
|
|
|
{
|
|
|
|
|
MusicPlayer.createPlaylistFromMusic();
|
|
|
|
|
}
|
|
|
|
|
else if (Params == "update_playlist")
|
|
|
|
|
{
|
|
|
|
|