summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/sound.h
Side-by-side diff
Diffstat (limited to 'noncore/games/sfcave-sdl/sound.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/sound.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/noncore/games/sfcave-sdl/sound.h b/noncore/games/sfcave-sdl/sound.h
new file mode 100644
index 0000000..d46b5bc
--- a/dev/null
+++ b/noncore/games/sfcave-sdl/sound.h
@@ -0,0 +1,35 @@
+#ifndef __SOUND_H
+#define __SOUND_H
+
+#include <SDL.h>
+#include "SDL_mixer.h"
+
+#define NR_SOUNDS 3
+
+class SoundHandler
+{
+public:
+ static bool init();
+ static void cleanUp();
+
+ static int playSound( int soundNr, int channel = -1, int nrLoops = 0, int playBeforeFinished = false );
+ static void stopSound( int channel, bool fadeOut, int nrMilliSecs = 1000 );
+ static void setSoundsOn( bool val );
+ static void setMusicOn( bool val );
+ static void playMusic( string musicFile );
+ static void playMusic( bool fadeIn = false );
+ static void stopMusic( bool fadeOut = false );
+ static void setMusicVolume( int vol );
+
+
+private:
+ static Mix_Music *music;
+ static Mix_Chunk *sounds[NR_SOUNDS];
+ static int soundChannels[NR_SOUNDS];
+ static bool soundOn;
+ static bool musicOn;
+
+ SoundHandler() {}
+};
+
+#endif