3bab45b0255c31ea02598dd0f49568e22a346f36
[supertux.git] / src / sound.h
1 /*
2   sound.h
3   
4   Super Tux - Audio Functions
5   
6   by Bill Kendrick
7   bill@newbreedsoftware.com
8   http://www.newbreedsoftware.com/supertux/
9
10   April 22, 2000 - July 15, 2002
11 */
12
13 #ifndef SUPERTUX_SOUND_H
14 #define SUPERTUX_SOUND_H
15
16  /*all the sounds we have*/
17 #define NUM_SOUNDS 16
18
19 /*global variable*/
20 int use_sound;
21
22 /* enum of different internal music types */
23 enum Music_Type {
24         NO_MUSIC,
25         LEVEL_MUSIC,
26         HURRYUP_MUSIC,
27         HERRING_MUSIC
28 } current_music;
29
30
31 #ifndef NOSOUND
32
33 #include <SDL_mixer.h>
34
35 /* variables for stocking the sound and music */
36 Mix_Chunk* sounds[NUM_SOUNDS];
37 Mix_Music* level_song, *herring_song;
38
39 /* functions handling the sound and music */
40 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
41
42 Mix_Chunk * load_sound(char * file);
43 void play_sound(Mix_Chunk * snd);
44 Mix_Music * load_song(char * file);
45
46 int playing_music(void);
47 int halt_music(void);
48 int play_music(Mix_Music*music, int loops);
49 void free_music(Mix_Music*music);
50 void free_chunk(Mix_Chunk*chunk);
51
52 #else
53
54 //fake variables
55 void* sounds[NUM_SOUNDS];
56 void* level_song, *herring_song;
57
58 // fake sound handlers
59 int open_audio (int frequency, int format, int channels, int chunksize);
60
61 void* load_sound(void* file);
62 void play_sound(void * snd);
63 void* load_song(void* file);
64
65 int playing_music();
66 void halt_music();
67 int play_music(void *music, int loops);
68 void free_music(void *music);;
69 void free_chunk(void *chunk);
70
71 #endif
72
73 #endif /*SUPERTUX_SOUND_H*/