2012-01-21 21:57:41 +01:00
|
|
|
#ifndef _MUSICPLAYER_H
|
|
|
|
#define _MUSICPLAYER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "gui_sound.h"
|
2012-08-05 15:48:15 +02:00
|
|
|
#include "config/config.hpp"
|
|
|
|
#include "list/cachedlist.hpp"
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
enum MusicDirectory
|
|
|
|
{
|
|
|
|
NORMAL_MUSIC = 1,
|
|
|
|
THEME_MUSIC = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
class MusicPlayer
|
|
|
|
{
|
|
|
|
public:
|
2012-07-05 16:27:05 +02:00
|
|
|
void cleanup();
|
2012-01-21 21:57:41 +01:00
|
|
|
void Init(Config &cfg, std::string musicDir, std::string themeMusicDir);
|
|
|
|
void Tick(bool attenuate);
|
2012-07-05 16:27:05 +02:00
|
|
|
|
2012-08-16 00:33:54 +02:00
|
|
|
void SetVolume(u8 volume);
|
|
|
|
u8 GetVolume() { return m_music_current_volume; };
|
|
|
|
u8 GetMaxVolume() { return m_music_volume; };
|
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
void Previous();
|
|
|
|
void Next();
|
|
|
|
void Play();
|
|
|
|
void Stop();
|
2012-08-16 00:33:54 +02:00
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
bool IsStopped() { return m_stopped; };
|
2012-08-16 00:33:54 +02:00
|
|
|
|
|
|
|
protected:
|
2012-01-21 21:57:41 +01:00
|
|
|
void LoadCurrentFile();
|
|
|
|
|
2012-08-16 00:33:54 +02:00
|
|
|
u8 m_music_volume;
|
|
|
|
u8 m_music_current_volume;
|
|
|
|
u8 m_fade_rate;
|
|
|
|
bool m_stopped;
|
|
|
|
|
|
|
|
GuiSound MusicFile;
|
2012-01-21 21:57:41 +01:00
|
|
|
CachedList<std::string> m_music_files;
|
2012-05-06 14:03:43 +02:00
|
|
|
vector<std::string>::iterator m_current_music;
|
2012-01-21 21:57:41 +01:00
|
|
|
};
|
|
|
|
|
2012-08-16 00:33:54 +02:00
|
|
|
extern MusicPlayer m_music;
|
2012-07-07 16:15:58 +02:00
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
#endif
|