Attempt to use Mix_SetMusicPosition to speed up MOD music. (Not very good)
[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 27, 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 /*all the sounds we have*/
22 #define NUM_SOUNDS 16
23
24 /*global variable*/
25 int use_sound;
26 int use_music;
27 int audio_device;        /* != 0: available and initialized */
28
29 /* enum of different internal music types */
30 enum Music_Type {
31   NO_MUSIC,
32   LEVEL_MUSIC,
33   HURRYUP_MUSIC,
34   HERRING_MUSIC
35 } current_music;
36
37
38 #ifndef NOSOUND
39
40 #include <SDL_mixer.h>
41
42 /* variables for stocking the sound and music */
43 Mix_Chunk* sounds[NUM_SOUNDS];
44 Mix_Music* level_song, *herring_song;
45
46 /* functions handling the sound and music */
47 int open_audio(int frequency, Uint16 format, int channels, int chunksize);
48
49 Mix_Chunk * load_sound(char * file);
50 void play_sound(Mix_Chunk * snd);
51 Mix_Music * load_song(char * file);
52
53 int playing_music(void);
54 int halt_music(void);
55 int play_music(Mix_Music*music, int loops);
56 void set_music_position(int pos);
57 void free_music(Mix_Music*music);
58 void free_chunk(Mix_Chunk*chunk);
59
60 #else
61
62 //fake variables
63 void* sounds[NUM_SOUNDS];
64 void* level_song, *herring_song;
65
66 // fake sound handlers
67 int open_audio (int frequency, int format, int channels, int chunksize);
68
69 void* load_sound(void* file);
70 void play_sound(void * snd);
71 void* load_song(void* file);
72
73 int playing_music();
74 void halt_music();
75 int play_music(void *music, int loops);
76 void free_music(void *music);
77 ;
78 void free_chunk(void *chunk);
79
80 #endif
81
82 #endif /*SUPERTUX_SOUND_H*/