2012-01-21 20:57:41 +00:00
|
|
|
#ifndef _MUSICPLAYER_H
|
|
|
|
#define _MUSICPLAYER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "gui_sound.h"
|
2012-08-05 13:48:15 +00:00
|
|
|
#include "config/config.hpp"
|
2012-01-21 20:57:41 +00:00
|
|
|
|
2012-08-16 12:47:25 +00:00
|
|
|
using namespace std;
|
2012-01-21 20:57:41 +00:00
|
|
|
|
|
|
|
class MusicPlayer
|
|
|
|
{
|
|
|
|
public:
|
2012-07-05 14:27:05 +00:00
|
|
|
void cleanup();
|
2012-08-16 12:47:25 +00:00
|
|
|
void Init(Config &cfg, string musicDir, string themeMusicDir);
|
2012-01-21 20:57:41 +00:00
|
|
|
void Tick(bool attenuate);
|
2012-07-05 14:27:05 +00:00
|
|
|
|
2012-08-15 22:33:54 +00:00
|
|
|
void SetVolume(u8 volume);
|
2012-08-25 22:53:23 +00:00
|
|
|
void SetMaxVolume(u8 volume);
|
2012-08-15 22:33:54 +00:00
|
|
|
u8 GetVolume() { return m_music_current_volume; };
|
|
|
|
u8 GetMaxVolume() { return m_music_volume; };
|
|
|
|
|
2012-01-21 20:57:41 +00:00
|
|
|
void Previous();
|
|
|
|
void Next();
|
|
|
|
void Play();
|
|
|
|
void Stop();
|
2012-08-15 22:33:54 +00:00
|
|
|
|
2012-01-21 20:57:41 +00:00
|
|
|
bool IsStopped() { return m_stopped; };
|
2012-08-15 22:33:54 +00:00
|
|
|
|
|
|
|
protected:
|
2012-01-21 20:57:41 +00:00
|
|
|
void LoadCurrentFile();
|
2012-08-16 12:47:25 +00:00
|
|
|
void ScanDirectories(const char *directory);
|
2012-01-21 20:57:41 +00:00
|
|
|
|
2012-08-15 22:33:54 +00:00
|
|
|
u8 m_music_volume;
|
|
|
|
u8 m_music_current_volume;
|
|
|
|
u8 m_fade_rate;
|
|
|
|
bool m_stopped;
|
|
|
|
|
|
|
|
GuiSound MusicFile;
|
2012-08-20 19:15:52 +00:00
|
|
|
vector<string> m_music_files;
|
|
|
|
vector<string>::iterator m_current_music;
|
2012-01-21 20:57:41 +00:00
|
|
|
};
|
|
|
|
|
2012-08-15 22:33:54 +00:00
|
|
|
extern MusicPlayer m_music;
|
2012-07-07 14:15:58 +00:00
|
|
|
|
2012-01-21 20:57:41 +00:00
|
|
|
#endif
|