00001 #ifndef __SOUND_H 00002 #define __SOUND_H 00003 00004 #include <SDL/SDL.h> 00005 #include <SDL/SDL_mixer.h> 00006 00007 #define NR_SOUNDS 3 00008 00009 class SoundHandler 00010 { 00011 public: 00012 static bool init(); 00013 static void cleanUp(); 00014 00015 static int playSound( int soundNr, int channel = -1, int nrLoops = 0, int playBeforeFinished = false ); 00016 static void stopSound( int channel, bool fadeOut, int nrMilliSecs = 1000 ); 00017 static void setSoundsOn( bool val ); 00018 static void setMusicOn( bool val ); 00019 static void playMusic( string musicFile ); 00020 static void playMusic( bool fadeIn = false ); 00021 static void stopMusic( bool fadeOut = false ); 00022 static void setMusicVolume( int vol ); 00023 00024 00025 private: 00026 static Mix_Music *music; 00027 static Mix_Chunk *sounds[NR_SOUNDS]; 00028 static int soundChannels[NR_SOUNDS]; 00029 static bool soundOn; 00030 static bool musicOn; 00031 00032 SoundHandler() {} 00033 }; 00034 00035 #endif
1.4.2