Fixed oversights in collision code. More sound control.
[luagame.git] / SoundEngine.h
blobf8b3dff4bd329a6fac4dc65d838fb6d2486d05f6
1 /*
2 =================
3 = SoundEngine.h =
4 =================
6 The sound engine.
8 This is sorta a wrapper around SDL_Mixer
9 It handles the sample cache though, so things don't get loaded
10 way too many times. SDL_Mixer is a really quite nice
11 and simple audio implementation.
13 Copyright (c)2006 - Brett Lajzer
16 #ifndef SOUNDENGINE_H
17 #define SOUNDENGINE_H
19 #include "SDL/SDL_mixer.h"
20 #include <map>
21 #include <string>
23 class SoundEngine{
24 public:
25 SoundEngine(){}; //don't ever instantiate this class. seriously.
26 static void open();
27 static void close();
28 static void play_music(const char *filename, int loops); //loops = -1 -> loops forever
29 static void stop_music();
30 static void play_sample(const char *filename);
31 static void load_sample(const char *filename);
32 static void unload_sample(const char *filename);
33 static void clear_samples();
35 private:
36 static Mix_Music *_music; // the music pointer
37 static std::string _m_filename; //the music filename
38 static std::map<std::string, Mix_Chunk *> _samples; //the sample cache
39 static const int _channels = 16; //the number of mixing channels
40 static const int _rate = 44100; //the mix rate in Hz
41 static const int _format = MIX_DEFAULT_FORMAT; //the output format
42 static const int _op_channels = 2; //output channels, 2 == stereo
43 static const int _chunksize = 2048; //output chunk size
45 #endif