blob: 180429aa78e802110e6ac0e48aabe2833d8b46d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef __SOUND_H
#define __SOUND_H
#include <SDL/SDL.h>
#include <SDL/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
|