Hummingbird Framework
 All Classes Functions Variables Modules Pages
SoundComponent.h
1 #ifndef HB_SOUND_COMPONENT_H
2 #define HB_SOUND_COMPONENT_H
3 #include <string>
4 #include <SFML/Audio.hpp>
5 #include "../Core/GameObject.h"
6 #include "../Core/Transform.h"
7 #include "SoundManager.h"
8 #include "SoundBuffer.h"
9 
10 namespace hb
11 {
17  {
18  public:
19  enum Status
20  {
21  Stopped,
22  Paused,
23  Playing
24  };
25 
27  SoundComponent(const SoundBuffer& buffer);
28  virtual ~SoundComponent() override;
29 
30  void update() override;
31 
32  void setBuffer(const SoundBuffer& buffer);
33  SoundBuffer& getBuffer();
34  const SoundBuffer& getBuffer() const;
35  void play();
36  void pause();
37  void stop();
38  Status getStatus() const;
39  Time getPlayingOffset() const;
40  void setPlayingOffset(const Time& offset);
41  void loop(bool loop);
42  bool isLooping() const;
43  void setPitch(double pitch);
44  double getPitch() const;
45  void setVolume(double volume);
46  double getVolume() const;
47  void setRelativeToListener(bool relative);
48  bool isRelativeToListener() const;
49  void setMinDistance(double distance);
50  double getMinDistance() const;
51  void setAttenuation(double attenuation);
52  double getAttenuation() const;
53 
54  private:
55  sf::Sound m_sound;
56  SoundBuffer m_buffer;
57  };
58 }
59 #endif
void update() override
Function called in the update step.
Object with a position, rotation and scale in a 3D space.
Definition: Transform.h:12
Definition: Box2DPlugin.h:6
Base class for implementing custom Components.
Definition: GameObject.h:57
Definition: SoundBuffer.h:13
Class for representing intervals of time.
Definition: Time.h:13
Definition: SoundComponent.h:16