-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSound.h
More file actions
44 lines (33 loc) · 832 Bytes
/
Sound.h
File metadata and controls
44 lines (33 loc) · 832 Bytes
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
43
44
#ifndef _SOUND_H__
#define _SOUND_H__
// system includes
#include <string>
#include <SFML/Audio.hpp>
namespace df{
class Sound{
private:
sf::Sound sound; // the sfml sound.
sf::SoundBuffer sound_buffer; // sfml sound buffer associated with sound.
std::string label; // text label to identify sound.
public:
Sound();
~Sound();
// Load sound buffer from file.
// Retrun 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 = false);
// Stop sound.
void stop();
// Pause sound.
void pause();
// Return sfml sound.
sf::Sound getSound() const;
};
}
#endif