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>
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.
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.
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.
21 #ifndef SUPERTUX_SOUND_H
22 #define SUPERTUX_SOUND_H
24 #include "defines.h" /* get YES/NO defines */
26 /* used to reserve some channels for panning effects */
27 #define SOUND_RESERVED_CHANNELS 2
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 option */
32 extern bool audio_device; /* != 0: available and initialized */
34 /* enum of different internal music types */
43 /* panning effects: terrible :-) ! */
45 SOUND_LEFT_SPEAKER = 0,
46 SOUND_RIGHT_SPEAKER = 1,
47 SOUND_CENTER_SPEAKER = -1
73 extern char* soundfilenames[NUM_SOUNDS];
76 #include <SDL_mixer.h>
78 /* variables for stocking the sound and music */
79 extern Mix_Chunk* sounds[NUM_SOUNDS];
80 extern Mix_Music* level_song;
81 extern Mix_Music* level_song_fast;
82 extern Mix_Music* herring_song;
84 /* functions handling the sound and music */
85 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
86 void close_audio( void );
88 Mix_Chunk * load_sound(const std::string& file);
89 void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker);
90 Mix_Music * load_song(const std::string& file);
92 int playing_music(void);
94 int play_music(Mix_Music*music, int loops);
95 void free_music(Mix_Music*music);
96 void free_chunk(Mix_Chunk*chunk);
98 int get_current_music();
99 void set_current_music(int music);
100 void play_current_music();
102 #endif /*SUPERTUX_SOUND_H*/