TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
tb_audio_controller.h
1 
10 #ifndef _TurtleBrains_AudioController_h_
11 #define _TurtleBrains_AudioController_h_
12 
13 #include "../core/tb_configuration.h"
14 #if defined(tb_with_audio)
15 
16 #include "../core/tb_types.h"
17 
18 namespace TurtleBrains
19 {
20  namespace Audio
21  {
22 
28 
32  extern const AudioHandle kInvalidAudio;
33 
39 
44  extern const AudioChannel kInvalidChannel;
45 
51  {
52  public:
59  explicit AudioController(const AudioHandle& audioHandle = kInvalidAudio);
60 
64  AudioController(const AudioController& other);
65 
71  ~AudioController(void);
72 
80  void Play(const bool isLooping = false);
81 
86  void Pause(void);
87 
92  void Stop(void);
93 
98  void StopLooping(void);
99 
105  float GetPitch(void) const;
106 
111  void SetPitch(const float pitch);
112 
118  float GetVolume(void) const;
119 
126  void SetVolume(const float volume);
127 
135  void FadeVolumeTo(const float desiredVolume, const tbCore::uint32 timeInMilliseconds);
136 
150  void SetLoopPoints(const tbCore::uint32 startSample, const tbCore::uint32 endSample);
151 
156  bool IsComplete(void) const;
157 
158  friend class AudioManager;
159  private:
160  AudioHandle mAudioData;
161  AudioChannel mAudioChannel;
162  };
163 
164  }; /* namespace Audio */
165 }; /* namespace TurtleBrains */
166 
167 namespace tbAudio = TurtleBrains::Audio;
168 
169 #endif /* tb_with_audio */
170 #endif /* _TurtleBrains_AudioController_h_ */
void SetPitch(const float pitch)
void SetLoopPoints(const tbCore::uint32 startSample, const tbCore::uint32 endSample)
tbCore::uint32 AudioChannel
Definition: tb_audio_controller.h:38
tbCore::uint32 AudioHandle
Definition: tb_audio_controller.h:27
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
void FadeVolumeTo(const float desiredVolume, const tbCore::uint32 timeInMilliseconds)
void Play(const bool isLooping=false)
AudioController(const AudioHandle &audioHandle=kInvalidAudio)
Definition: tb_audio_controller.h:50
Definition: tb_audio_manager.h:34
Bring some sound into the games created with TurtleBrains using a very simple fire and forget AudioMa...
Definition: tb_audio_controller.h:20
uint32_t uint32
Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1)...
Definition: tb_types.h:28
const AudioHandle kInvalidAudio
const AudioChannel kInvalidChannel
void SetVolume(const float volume)