forked from NaiJi/project-kyoku
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
649 B
C++
36 lines
649 B
C++
#pragma once
|
|
|
|
#include <SFML/Audio/Music.hpp>
|
|
#include <SFML/System/Clock.hpp>
|
|
|
|
#include "tools/mathutils.h"
|
|
|
|
class Music
|
|
{
|
|
public:
|
|
explicit Music();
|
|
|
|
bool openFromFile(const std::string& filepath);
|
|
|
|
void play();
|
|
void pause();
|
|
void stop();
|
|
|
|
bool isPaused() const;
|
|
|
|
void setVolume(int volume);
|
|
|
|
void setOffset(const microsec& offset);
|
|
void moveOffset(const microsec& delta);
|
|
microsec fetchOffset();
|
|
microsec getDuration() const;
|
|
|
|
private:
|
|
sf::Music _music;
|
|
sf::Clock _offset_interpolator;
|
|
|
|
microsec _sfml_music_offset;
|
|
microsec _previous_frame_offset;
|
|
microsec _absolute_offset;
|
|
};
|