Thrive
sound_emitter.h
1 #pragma once
2 
3 #include <stdint.h>
4 #include <memory>
5 
6 namespace Ogre {
7 
8  class SceneNode;
9 }
10 
11 namespace cAudio {
12 
13  class IAudioSource;
14  class IAudioManager;
15 }
16 
17 namespace thrive {
18 
19  class SoundEmitter final{
20 public:
21 
22  SoundEmitter(cAudio::IAudioSource* audioObject);
23  ~SoundEmitter();
24 
25  void loop(bool actuallyLoop);
26 
28  void
29  play(
30  bool forceRestart = false
31  );
32 
34  void pause();
35 
37  void stop();
38 
40  void disable3D(bool disable);
41 
42 
44  void setVolume(float volume);
45 
47  void setRolloffFactor(float rolloff);
48 
50  void setMaxDistance(float distance);
51 
53  void startFade(bool fadeIn, float time);
54 
61  float getAudioLength();
62 
64  void detachFromNode();
65 
67  void
69  Ogre::SceneNode* node
70  );
71 
72  void
73  destroyInternal(
74  cAudio::IAudioManager* manager
75  );
76 
77 private:
78 
79  struct Implementation;
80  std::unique_ptr<Implementation> m_impl;
81 };
82 
83 }
84 
void play(bool forceRestart=false)
Starts playing this sound if not already.
Definition: sound_emitter.cpp:92
void setMaxDistance(float distance)
Sets the distance at which attenuation will stop.
Definition: sound_emitter.cpp:155
float getAudioLength()
Returns the length of the audio attached.
Definition: sound_emitter.cpp:174
void pause()
Pauses the audio if playing.
Definition: sound_emitter.cpp:112
void attachToNode(Ogre::SceneNode *node)
Attaches this object to an Ogre SceneNode and makes this move with the node.
Definition: sound_emitter.cpp:187
void stop()
Stops the audio (losing the current spot)
Definition: sound_emitter.cpp:119
Definition: sound_emitter.h:11
void detachFromNode()
Detaches this from a scene node, stops this from moving with the node.
Definition: sound_emitter.cpp:181
Definition: sound_emitter.h:19
void setVolume(float volume)
Sets volume, multiplier default is 1.f.
Definition: sound_emitter.cpp:139
Definition: bullet_ogre_conversion.h:6
void setRolloffFactor(float rolloff)
Sets how fast the sound fades with distance.
Definition: sound_emitter.cpp:147
void disable3D(bool disable)
Disables 3D audio.
Definition: sound_emitter.cpp:126
Definition: debug_drawing.h:8
void startFade(bool fadeIn, float time)
Definition: sound_emitter.cpp:163