2012-09-22 15:47:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2012 FIX94
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _MUSICPLAYER_HPP_
|
|
|
|
#define _MUSICPLAYER_HPP_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "gui_sound.h"
|
|
|
|
#include "config/config.hpp"
|
|
|
|
#include "wstringEx/wstringEx.hpp"
|
|
|
|
|
|
|
|
class Musicplayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Cleanup();
|
2012-10-04 13:37:53 +02:00
|
|
|
void Init(Config &cfg, const string& musicDir, const string& themeMusicDir);
|
2018-11-03 16:03:58 +01:00
|
|
|
int InitPlaylist(Config &cfg, const char *playlist, u8 device);
|
2012-09-22 15:47:52 +02:00
|
|
|
void Tick(bool attenuate);
|
2020-05-26 00:17:50 +02:00
|
|
|
|
2018-10-31 20:51:15 +01:00
|
|
|
void SetFadeRate(u8 faderate);
|
2012-09-22 15:47:52 +02:00
|
|
|
void SetVolume(u8 volume);
|
|
|
|
void SetMaxVolume(u8 volume);
|
|
|
|
u8 GetVolume() { return CurrentVolume; };
|
|
|
|
u8 GetMaxVolume() { return Volume; };
|
2020-05-26 00:17:50 +02:00
|
|
|
bool ResampleSetting;
|
|
|
|
void SetResampleSetting(bool resample);
|
2012-09-22 15:47:52 +02:00
|
|
|
|
|
|
|
void Previous();
|
|
|
|
void Next();
|
|
|
|
void Stop();
|
2018-11-19 19:14:40 +01:00
|
|
|
void Pause();
|
|
|
|
void Resume();
|
2012-09-22 15:47:52 +02:00
|
|
|
|
|
|
|
bool IsStopped() { return MusicStopped; };
|
|
|
|
|
|
|
|
/* For our GUI */
|
|
|
|
wstringEx GetFileName();
|
|
|
|
bool SongChanged();
|
|
|
|
time_t DisplayTime;
|
2013-02-23 18:41:26 +01:00
|
|
|
bool OneSong;
|
2020-05-26 00:17:50 +02:00
|
|
|
|
2013-03-23 18:06:06 +01:00
|
|
|
void LoadFile(const char *name, bool display_change = true);
|
2020-05-26 00:17:50 +02:00
|
|
|
void LoadCurrentFile();
|
2020-09-01 01:23:52 +02:00
|
|
|
void ReLoadCurrentFile();
|
2012-09-22 15:47:52 +02:00
|
|
|
protected:
|
|
|
|
bool PosFromPrevFile();
|
|
|
|
|
|
|
|
u8 Volume;
|
|
|
|
u8 CurrentVolume;
|
|
|
|
u8 FadeRate;
|
|
|
|
int CurrentPosition;
|
|
|
|
bool MusicStopped;
|
|
|
|
bool MusicChanged;
|
2018-11-03 16:03:58 +01:00
|
|
|
const char *curPlaylist;
|
|
|
|
bool usingPlaylist = false;
|
|
|
|
u8 pl_device;
|
2012-09-22 15:47:52 +02:00
|
|
|
|
|
|
|
GuiSound MusicFile;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Musicplayer MusicPlayer;
|
|
|
|
|
|
|
|
#endif /* _MUSICPLAYER_HPP_ */
|