-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSound.h
42 lines (33 loc) · 875 Bytes
/
Sound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __SOUND_H__
#define __SOUND_H__
#include <string>
#include <SFML/Audio.hpp>
namespace df {
class Sound
{
private:
sf::Sound m_sound; // The SFML sound.
sf::SoundBuffer m_sound_buffer; // SFML sound buffer associated with sound.
std::string m_label; // Text label to identify sound.
public:
Sound();
~Sound();
// Load sound buffer from file.
// Return 0 if ok, else -1.
int loadSound(std::string filename);
// Set label associated with sound.
void setLabel(std::string new_label);
// Get label associated with sound.
std::string getLabel() const;
// Play sound.
// If loop is true, repeat play when done.
void play(bool loop);
// Stop sound.
void stop();
// Pause sound.
void pause();
// Return SFML sound.
sf::Sound getSound() const;
};
}
#endif