Game Develop C++ Platform: Music.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Music.h
Go to the documentation of this file.
1
5 #ifndef MUSIC_H
6 #define MUSIC_H
7 #include <SFML/Audio.hpp>
8 #include <string>
9
15 class GD_API Music
16 {
17 public:
18 Music();
19 virtual ~Music();
20
31 bool OpenFromFile(const std::string & filename);
32
38 void SetBuffer(const char * newbuffer, std::size_t size);
39
44 bool OpenFromMemory(std::size_t size);
45
46 sf::Music music;
47 char * buffer;
48
52 void Play();
53
57 void Pause();
58
62 void Stop();
63
68 inline sf::Music::Status GetStatus() const { return music.getStatus(); };
69
74 void SetLoop(bool loop);
75
80 void SetVolume(float volume_);
81
85 inline float GetVolume() const { return volume; }
86
90 void SetPitch(float newPitch) { music.setPitch(newPitch); };
91
95 float GetPitch() const { return music.getPitch(); };
96
101 void SetPlayingOffset(unsigned int timeOffset) { music.setPlayingOffset(sf::seconds(timeOffset)); };
102
106 unsigned int GetPlayingOffset() const { return music.getPlayingOffset().asSeconds(); };
107
113 void UpdateVolume();
114
115 #if defined(GD_IDE_ONLY)
116 std::string file;
117 #endif
118
119 private:
120 float volume;
121 };
122
123 #endif // MUSIC_H
124