Debian Codegraph @

src/gengine/SDLSoundAgent.h

raw
1 #ifndef HEADER_SDLSOUNDAGENT_H
2 #define HEADER_SDLSOUNDAGENT_H
3
4 #include "SoundAgent.h"
5 #include "SDLMusicLooper.h"
6
7 #include "SDL.h"
8 #include "SDL_mixer.h"
9 #include <string>
10
11 /**
12 * Sound and music.
13 */
14 class SDLSoundAgent : public SoundAgent {
15 private:
16 static BaseMsg *ms_finished;
17 Mix_Music *m_music;
18 SDLMusicLooper *m_looper;
19 std::string m_playingPath;
20 int m_soundVolume;
21 int m_musicVolume;
22
23 private:
24 std::string generateIdName(const Path &file);
25 Mix_Chunk *findChunk(const std::string &name);
26
27 static void musicFinished();
28 protected:
29 virtual void own_init();
30 virtual void own_shutdown();
31 virtual void reinit();
32
33 virtual void setSoundVolume(int volume);
34 virtual void setMusicVolume(int volume);
35 public:
36 virtual int playSound(Mix_Chunk *sound, int volume, int loops=0);
37
38 virtual void playMusic(const Path &file,
39 BaseMsg *finished);
40 virtual void stopMusic();
41 };
42
43 #endif