Game Develop C++ Platform: Sound.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
Sound.h
Go to the documentation of this file.
1
5 #ifndef SOUND_H
6 #define SOUND_H
7 #include <SFML/Audio.hpp>
8 #include <string>
9
16 class GD_API Sound : sf::NonCopyable
17 {
18 public:
19 Sound();
20 Sound(std::string file);
21 Sound(const Sound & copy);
22 virtual ~Sound();
23
27 inline sf::Sound::Status GetStatus() const { return sound.getStatus(); }
28
32 void SetVolume(float volume_);
33
37 inline float GetVolume() const { return volume; }
38
42 void SetPitch(float newPitch) { sound.setPitch(newPitch); };
43
47 float GetPitch() const { return sound.getPitch(); };
48
52 void SetPlayingOffset(unsigned int timeOffset) { sound.setPlayingOffset(sf::milliseconds(timeOffset)); };
53
57 unsigned int GetPlayingOffset() const { return sound.getPlayingOffset().asMilliseconds(); };
58
59 //Order is important :
60 sf::SoundBuffer buffer;
61 sf::Sound sound;
62
63 std::string file;
64
68 void UpdateVolume();
69
70 private:
71 float volume;
72 };
73
74 #endif // SOUND_H
75