1 /*
2  * Triplane Classic - a side-scrolling dogfighting game.
3  * Copyright (C) 1996,1997,2009  Dodekaedron Software Creations Oy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  * tjt@users.sourceforge.net
19  */
20 
21 #ifndef SDL_COMPAT_H
22 #define SDL_COMPAT_H
23 #include <stdint.h>
24 #ifdef HAVE_SDL_MIXER
25 #include <SDL_mixer.h>
26 #endif
27 
28 #define SAMPLE_VOLUME 20
29 
30 #define PAUSE_KEY SDLK_PAUSE
31 
32 #define SOUNDCARD_NONE 0
33 #define SOUNDCARD_GUS  1
34 #define SOUNDCARD_SB   2
35 #define SOUNDCARD_SDL  3
36 
37 int kbhit(void);
38 int getch(void);
39 
40 extern unsigned char *key;
41 
42 typedef struct {
43     int right_volume, left_volume;
44 #ifdef HAVE_SDL_MIXER
45     Mix_Chunk *chunk;
46 #endif
47 } sb_sample;
48 
49 typedef struct {
50 #ifdef HAVE_SDL_MIXER
51     Mix_Music *music;
52 #endif
53 } sb_mod_file;
54 
55 void update_key_state(void);
56 int sdl_init_sounds(void);
57 void sdl_uninit_sounds(void);
58 void sdl_play_sample(sb_sample * sample, int looping = 0);
59 void sdl_stop_all_samples(void);
60 sb_sample *sdl_sample_load(const char *name);
61 void sdl_free_sample(sb_sample * sample);
62 
63 sb_mod_file *sdl_load_mod_file(const char *name);
64 void sdl_free_mod_file(sb_mod_file * mod);
65 void sdl_play_music(sb_mod_file * mod);
66 void sdl_stop_music(void);
67 
68 #endif
69