Store user data in $HOME
[kball.git] / include / sound.h
blobb903ea4b39ffdd3d964c1757e962a4cb9782e818
1 // -----------------------------------------------
2 // Sound System
3 // By Kronoman
4 // Copyright (c) 2004, Kronoman
5 // In loving memory of my father
6 // -----------------------------------------------
7 // sound.h
8 // -----------------------------------------------
9 // This system wraps around Allegro and DUMB,
10 // so I can use the high level sound routines,
11 // global adjust volume, disable volume, etc
12 // -----------------------------------------------
13 #ifndef _KRONO_SOUND_H
14 #define _KRONO_SOUND_H
16 #include <allegro.h> // Allegro : http://alleg.sf.net/
17 #include <aldumb.h> // DUMB : http://dumb.sf.net/
19 class CSoundWrapper
21 public:
22 CSoundWrapper();
23 ~CSoundWrapper();
25 // digital samples
26 int play_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop); // digital sample playing
27 void set_volume_d(int v); // volume digital
28 int get_volume_d();
30 // music
31 void music_load(DUH *dat); // call this before playing, dat should be a pointer to a music object of a datafile
33 void music_start(); // start playing
35 void music_pause(); // pause playback
36 void music_resume(); // pause playback
38 void music_poll(); // _must_ be called at regular intervals to hear the music
40 void music_stop(); // stop playing
42 void set_volume_m(int v); // volume music
43 int get_volume_m();
45 // for all the object
46 void set_enabled(bool s);
47 bool is_enabled();
49 // for all the class
50 static void global_set_volume(int v);
51 static int global_get_volume();
53 static void global_set_enabled(bool s);
54 static bool global_is_enabled();
56 private:
57 // for this object
58 bool enabled; // enable this object player (if false, nothing will be played)
59 int volume_d; // volume, 0 to 255
60 int volume_m; // volume music, 0 to 255
62 // for all the class
63 static bool global_enabled; // enables the sound system ?
64 static int global_volume; // global volume, 0 to 255
66 DUH *duh;
67 AL_DUH_PLAYER *dp;
70 #endif