UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sample.h
Go to the documentation of this file.
1 #ifndef HORUSEYE_FRAMEWORK_SAMPLE_H_
2 #define HORUSEYE_FRAMEWORK_SAMPLE_H_
3 
4 #include <string>
5 #include "SDL_mixer.h"
6 
7 #include <ugdk/audio.h>
8 
9 namespace ugdk {
10 namespace audio {
11 
18 class Sample {
19  public:
21  void Play();
22 
24  void PlayForever();
25 
27  void Play(int loops);
28 
30  void Stop();
31 
33  bool IsPlaying();
34 
36 
39  void SetVolume(double vol);
40 
42 
43  double Volume();
44 
45  private:
46  Sample(const std::string& filepath);
47  ~Sample();
48  Mix_Chunk *data_;
49  int channel_;
50  double volume_;
51 
52  friend class Manager;
53 };
54 
55 } // namespace audio
56 } // namespace ugdk
57 
58 #endif
bool IsPlaying()
Returns whether the sound is playing or not.
void Stop()
Stops playing the sound.
Definition: sample.h:18
void SetVolume(double vol)
Sets the volume.
Definition: animation.h:11
double Volume()
Returns the sound's volume.
Definition: manager.h:12
void PlayForever()
Plays this sample until told to stop.
void Play()
Plays the sound.