dEngine
Simple 2D C++ game engine
Sound.h
Go to the documentation of this file.
1 #ifndef DENGINE_SOUND_H
2 #define DENGINE_SOUND_H
3 
4 #include <string>
5 #include <iostream>
6 #include <SDL.h>
7 #include "../Universal.h"
8 
9 namespace dengine {
16  class Sound {
17 
18  public:
24  Sound(std::string filepath);
25 
30  ~Sound();
31 
35  void LoadSound();
36 
40  void PlaySound();
41 
45  void StopSound();
46 
47  private:
48  void SetupDevice();
49 
53  std::string filePath;
57  SDL_AudioDeviceID m_device;
61  SDL_AudioSpec m_audioSpec;
65  Uint8 *m_waveStart;
69  Uint32 m_waveLength;
70  };
71 }
72 
73 #endif //DENGINE_SOUND_H
~Sound()
Destructor.
Definition: Sound.cpp:9
Sound(std::string filepath)
Constructor.
Definition: Sound.cpp:5
void PlaySound()
Plays the sound.
Definition: Sound.cpp:21
SDL_AudioDeviceID m_device
Definition: Sound.h:57
Uint8 * m_waveStart
Definition: Sound.h:65
void StopSound()
Stops the sound from playing.
Definition: Sound.cpp:26
void SetupDevice()
Definition: Sound.cpp:30
Uint32 m_waveLength
Definition: Sound.h:69
A Sound.
Definition: Sound.h:16
void LoadSound()
Loads sound into memory.
Definition: Sound.cpp:14
The namespace containing the engine&#39;s code.
Definition: Collider.h:9
std::string filePath
Definition: Sound.h:53
SDL_AudioSpec m_audioSpec
Definition: Sound.h:61