ye another sound patch from Duong-Khang NGUYEN <neoneurone@users.sf.net>.
[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 #include "defines.h"     /* get YES/NO defines */
17
18 /*all the sounds we have*/
19 #define NUM_SOUNDS 16
20
21 /*global variable*/
22 int use_sound;
23 int audio_device;        /* != 0: available and initialized */
24
25 /* enum of different internal music types */
26 enum Music_Type {
27   NO_MUSIC,
28   LEVEL_MUSIC,
29   HURRYUP_MUSIC,
30   HERRING_MUSIC
31 } current_music;
32
33
34 #ifndef NOSOUND
35
36 #include <SDL_mixer.h>
37
38 /* variables for stocking the sound and music */
39 Mix_Chunk* sounds[NUM_SOUNDS];
40 Mix_Music* level_song, *herring_song;
41
42 /* functions handling the sound and music */
43 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
44
45 Mix_Chunk * load_sound(char * file);
46 void play_sound(Mix_Chunk * snd);
47 Mix_Music * load_song(char * file);
48
49 int playing_music(void);
50 int halt_music(void);
51 int play_music(Mix_Music*music, int loops);
52 void free_music(Mix_Music*music);
53 void free_chunk(Mix_Chunk*chunk);
54
55 #else
56
57 //fake variables
58 void* sounds[NUM_SOUNDS];
59 void* level_song, *herring_song;
60
61 // fake sound handlers
62 int open_audio (int frequency, int format, int channels, int chunksize);
63
64 void* load_sound(void* file);
65 void play_sound(void * snd);
66 void* load_song(void* file);
67
68 int playing_music();
69 void halt_music();
70 int play_music(void *music, int loops);
71 void free_music(void *music);
72 ;
73 void free_chunk(void *chunk);
74
75 #endif
76
77 #endif /*SUPERTUX_SOUND_H*/