MiniEngine/SDLWrapper/Music.h

52 lines
929 B
C
Raw Normal View History

#pragma once
#include "include.h"
2017-06-18 20:37:45 +08:00
#include <memory>
#include <string>
#include "ErrorViewer.h"
#include "Audio.h"
#include "begin_code.h"
/// Forward Declaration
class Music
{
public:
protected:
Music() = default;
private:
std::shared_ptr<Mix_Music> _music;
void _set(Mix_Music*);
void _clear();
Mix_Music* _get();
friend class MusicPlayer;
};
class MusicPlayer : public AudioPlayer
{
public:
static int GetDecoderNum();
static std::string GetDecoderName(int index);
2017-06-18 20:37:45 +08:00
Music loadMusic(const std::string& Filename) throw (ErrorViewer);
int play(Music music, int loops);
void pause();
void resume();
void rewind();
int stop();
int fadeIn(int loops, int ms);
int fadeOut(int ms);
bool isPlaying();
bool isPaused();
int isFading();
/// Experimental
static int SetMusicPosition(double position);
private:
Music m;
};
#include "end_code.h"