Kick and stomp sounds when you hit the laptop. Moved sound defs to sound.h
[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 - December 28, 2003
11
12   Current maintainer:
13         Duong-Khang NGUYEN <neoneurone@users.sf.net>
14 */
15
16 #ifndef SUPERTUX_SOUND_H
17 #define SUPERTUX_SOUND_H
18
19 #include "defines.h"     /* get YES/NO defines */
20
21 /*global variable*/
22 int use_sound;
23 int use_music;
24 int audio_device;        /* != 0: available and initialized */
25
26 /* enum of different internal music types */
27 enum Music_Type {
28   NO_MUSIC,
29   LEVEL_MUSIC,
30   HURRYUP_MUSIC,
31   HERRING_MUSIC
32 } current_music;
33
34 /* Sound files: */
35
36 enum {
37   SND_JUMP,
38   SND_BIGJUMP,
39   SND_SKID,
40   SND_DISTRO,
41   SND_HERRING,
42   SND_BRICK,
43   SND_HURT,
44   SND_SQUISH,
45   SND_FALL,
46   SND_RICOCHET,
47   SND_BUMP_UPGRADE,
48   SND_UPGRADE,
49   SND_EXCELLENT,
50   SND_COFFEE,
51   SND_SHOOT,
52   SND_LIFEUP,
53   SND_STOMP,
54   SND_KICK,
55   NUM_SOUNDS
56 };
57
58
59 static char * soundfilenames[NUM_SOUNDS] = {
60                                       DATA_PREFIX "/sounds/jump.wav",
61                                       DATA_PREFIX "/sounds/bigjump.wav",
62                                       DATA_PREFIX "/sounds/skid.wav",
63                                       DATA_PREFIX "/sounds/distro.wav",
64                                       DATA_PREFIX "/sounds/herring.wav",
65                                       DATA_PREFIX "/sounds/brick.wav",
66                                       DATA_PREFIX "/sounds/hurt.wav",
67                                       DATA_PREFIX "/sounds/squish.wav",
68                                       DATA_PREFIX "/sounds/fall.wav",
69                                       DATA_PREFIX "/sounds/ricochet.wav",
70                                       DATA_PREFIX "/sounds/bump-upgrade.wav",
71                                       DATA_PREFIX "/sounds/upgrade.wav",
72                                       DATA_PREFIX "/sounds/excellent.wav",
73                                       DATA_PREFIX "/sounds/coffee.wav",
74                                       DATA_PREFIX "/sounds/shoot.wav",
75                                       DATA_PREFIX "/sounds/lifeup.wav",
76                                       DATA_PREFIX "/sounds/stomp.wav",
77                                       DATA_PREFIX "/sounds/kick.wav"
78                                     };
79
80
81 #ifndef NOSOUND
82
83 #include <SDL_mixer.h>
84
85 /* variables for stocking the sound and music */
86 Mix_Chunk * sounds[NUM_SOUNDS];
87 Mix_Music * level_song, * level_song_fast, * herring_song;
88
89 /* functions handling the sound and music */
90 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
91
92 Mix_Chunk * load_sound(char * file);
93 void play_sound(Mix_Chunk * snd);
94 Mix_Music * load_song(char * file);
95
96 int playing_music(void);
97 int halt_music(void);
98 int play_music(Mix_Music*music, int loops);
99 void free_music(Mix_Music*music);
100 void free_chunk(Mix_Chunk*chunk);
101
102 #else
103
104 //fake variables
105 void* sounds[NUM_SOUNDS];
106 void* level_song, *herring_song;
107
108 // fake sound handlers
109 int open_audio (int frequency, int format, int channels, int chunksize);
110
111 void* load_sound(void* file);
112 void play_sound(void * snd);
113 void* load_song(void* file);
114
115 int playing_music();
116 void halt_music();
117 int play_music(void *music, int loops);
118 void free_music(void *music);
119 ;
120 void free_chunk(void *chunk);
121
122 #endif
123
124 #endif /*SUPERTUX_SOUND_H*/