1 #ifndef AUDIOMANAGER_H_INCLUDED
2 #define AUDIOMANAGER_H_INCLUDED
4 #include <SDL2/SDL_mixer.h>
27 void play(
int numLoops = 0)
const {
28 Mix_PlayChannel(-1,
m_chunk, numLoops);
48 void play(
int numLoops = 1)
const {
49 Mix_PlayMusic(
m_music, numLoops);
69 static std::map<std::string, Music*> m_musicMap;
77 static Music* getMusic(crstring musicPath);
81 #endif // AUDIOMANAGER_H_INCLUDED
void pause() const
pauses music (can be resumed)
static void destroy()
frees all music
void stop() const
stops music (must be replayed from beginning)
Music(Mix_Music *m)
constructor simply stores music
SoundEffect(Mix_Chunk *c)
Constructor simple stores a chunk.
static std::map< std::string, SoundEffect * > m_effectMap
maps for associating sounds with their files
static void init()
initializes SDL_Mixer
Mix_Chunk * m_chunk
the chunk representing the stored sound effect
Represents a sound effect or short audio clip.
~SoundEffect()
Destructor frees chunk.
static SoundEffect * getSoundEffect(crstring effectPath)
returns sound
Mix_Music * m_music
the stored music
~Music()
destructor frees stored music
void play(int numLoops=0) const
plays the sound effect
void resume() const
resumes paused music
Represents a longer piece of music.
void play(int numLoops=1) const
plays music