1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef NL_MUSIC_PLAYER_H
23 #define NL_MUSIC_PLAYER_H
25 #include "nel/misc/types_nl.h"
26 #include "nel/misc/stream.h"
27 #include "dbctrl_sheet.h"
28 #include "nel/gui/group_container.h"
30 // ***************************************************************************
33 This class handle the music player playlist actions.
41 /* Play list commands */
45 CSongs(std::string file
= std::string(), std::string title
= std::string(), float length
= 0.f
)
46 : Filename(file
), Title(title
), Length(length
)
54 void playSongs (const std::vector
<std::string
> &filenames
);
55 void play (sint index
= -1); // Play the song at current position, if playing, restart. If paused, resume.
61 /* Update the playlist. Call it in the main loop */
65 // update currently playing song info/duration on main gui
66 void updatePlayingInfo(const std::string info
);
67 void clearPlayingInfo();
69 bool isRepeatEnabled() const;
70 bool isShuffleEnabled() const;
72 // Build playlist UI from songs
73 void rebuildPlaylist();
74 // Randomize playlist and rebuild the ui
75 void shuffleAndRebuildPlaylist();
76 // Update playlist active row
77 void updatePlaylist(sint prevIndex
= -1);
78 // set/remove playlist highlight
79 void updatePlaylist(uint index
, bool state
);
81 // Update single song title/duration on _Songs and on playlist
82 void updateSong(const CSongs
&song
);
84 // Update _Songs and playlist from _SongUpdateQueue
87 // update song from worker thread
88 void updateSong(const std::string filename
, const std::string title
, float length
);
90 // scan music folder and rebuild playlist
91 void createPlaylistFromMusic();
97 uint _CurrentSongIndex
; // If (!_Songs.empty()) must always be <_Songs.size()
98 std::vector
<CSongs
> _Songs
;
99 // updated info from worker thread
100 std::vector
<CSongs
> _SongUpdateQueue
;
103 enum TState
{ Stopped
, Playing
, Paused
} _State
;
109 extern CMusicPlayer MusicPlayer
;
111 // ***************************************************************************
113 #endif // NL_MUSIC_PLAYER_H
115 /* End of music_player.h */