2012-01-21 21:57:41 +01:00
|
|
|
#ifndef _MUSICPLAYER_H
|
|
|
|
#define _MUSICPLAYER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "config/config.hpp"
|
|
|
|
|
|
|
|
#include "cachedlist.hpp"
|
|
|
|
#include "gui_sound.h"
|
|
|
|
|
|
|
|
enum MusicDirectory
|
|
|
|
{
|
|
|
|
NORMAL_MUSIC = 1,
|
|
|
|
THEME_MUSIC = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ASND_MUSIC_VOICE 0
|
|
|
|
|
|
|
|
class MusicPlayer
|
|
|
|
{
|
|
|
|
public:
|
2012-07-05 16:27:05 +02:00
|
|
|
MusicPlayer();
|
2012-07-08 15:35:59 +02:00
|
|
|
~MusicPlayer();
|
|
|
|
|
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-01-21 21:57:41 +01:00
|
|
|
void SetVolume(int volume);
|
|
|
|
void SetVolume(int volume, int max_volume);
|
|
|
|
int GetVolume() { return m_music != NULL ? m_music_current_volume : 0; };
|
|
|
|
int GetMaxVolume() { return m_music_volume; };
|
|
|
|
|
|
|
|
void Previous();
|
|
|
|
void Next();
|
|
|
|
void Pause();
|
|
|
|
void Play();
|
|
|
|
void Stop();
|
|
|
|
|
|
|
|
bool IsStopped() { return m_stopped; };
|
|
|
|
private:
|
|
|
|
void LoadCurrentFile();
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
int m_fade_rate;
|
|
|
|
|
|
|
|
int m_music_volume;
|
|
|
|
int m_music_current_volume;
|
|
|
|
bool m_manual_stop;
|
|
|
|
|
|
|
|
bool m_paused;
|
|
|
|
bool m_stopped;
|
|
|
|
bool m_playbackFinished;
|
|
|
|
|
|
|
|
GuiSound *m_music;
|
|
|
|
u32 *m_songCount;
|
|
|
|
};
|
|
|
|
|
2012-07-07 16:15:58 +02:00
|
|
|
extern MusicPlayer *m_music;
|
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
#endif
|