Ooops, did a mistake. Fixed by Arkadiusz Miskiewicz.
[supertux.git] / src / sound.h
1 //  $Id$
2 //
3 //  SuperTux -  A Jump'n Run
4 //  Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 //  Copyright (C) 2004 Duong-Khang NGUYEN <neoneurone@users.sf.net>
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 #ifndef SUPERTUX_SOUND_H
22 #define SUPERTUX_SOUND_H
23
24 #include "defines.h"     /* get YES/NO defines */
25
26 /* used to reserve some channels for panning effects */
27 #define SOUND_RESERVED_CHANNELS 2
28
29 /*global variable*/
30 extern bool use_sound;           /* handle sound on/off menu and command-line option */
31 extern bool use_music;           /* handle music on/off menu and command-line */
32 extern bool audio_device;        /* != 0: available and initialized */
33
34 /* enum of different internal music types */
35 enum Music_Type {
36   NO_MUSIC,
37   LEVEL_MUSIC,
38   HURRYUP_MUSIC,
39   HERRING_MUSIC
40 };
41
42
43 /* panning effects: terrible :-) ! */
44 enum Sound_Speaker {
45   SOUND_LEFT_SPEAKER = 0,
46   SOUND_RIGHT_SPEAKER = 1,
47   SOUND_CENTER_SPEAKER = -1
48 };
49
50 /* Sound files: */
51 enum {
52   SND_JUMP,
53   SND_BIGJUMP,
54   SND_SKID,
55   SND_DISTRO,
56   SND_HERRING,
57   SND_BRICK,
58   SND_HURT,
59   SND_SQUISH,
60   SND_FALL,
61   SND_RICOCHET,
62   SND_BUMP_UPGRADE,
63   SND_UPGRADE,
64   SND_EXCELLENT,
65   SND_COFFEE,
66   SND_SHOOT,
67   SND_LIFEUP,
68   SND_STOMP,
69   SND_KICK,
70   SND_EXPLODE,
71   NUM_SOUNDS
72 };
73
74 extern char* soundfilenames[NUM_SOUNDS];
75
76 #include <string>
77 #include <SDL_mixer.h>
78
79 /* variables for stocking the sound and music */
80 extern Mix_Chunk* sounds[NUM_SOUNDS];
81
82 /* functions handling the sound and music */
83 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
84 void close_audio( void );
85
86 Mix_Chunk * load_sound(const std::string& file);
87 void free_chunk(Mix_Chunk*chunk);
88 void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker);
89
90 #endif /*SUPERTUX_SOUND_H*/