#include "defines.h" /* get YES/NO defines */
+/* used to reserve some channels for panning effects */
+#define SOUND_RESERVED_CHANNELS 2
+
/*global variable*/
-int use_sound;
-int use_music;
+int use_sound; /* handle sound on/off menu and command-line option */
+int use_music; /* handle music on/off menu and command-line option */
int audio_device; /* != 0: available and initialized */
/* enum of different internal music types */
HERRING_MUSIC
} current_music;
-/* Sound files: */
+/* panning effects: terrible :-) ! */
+enum Sound_Speaker {
+ SOUND_LEFT_SPEAKER = 0,
+ SOUND_RIGHT_SPEAKER = 1,
+ SOUND_CENTER_SPEAKER = -1
+};
+/* Sound files: */
enum {
SND_JUMP,
SND_BIGJUMP,
NUM_SOUNDS
};
-
-static char * soundfilenames[NUM_SOUNDS] = {
- DATA_PREFIX "/sounds/jump.wav",
- DATA_PREFIX "/sounds/bigjump.wav",
- DATA_PREFIX "/sounds/skid.wav",
- DATA_PREFIX "/sounds/distro.wav",
- DATA_PREFIX "/sounds/herring.wav",
- DATA_PREFIX "/sounds/brick.wav",
- DATA_PREFIX "/sounds/hurt.wav",
- DATA_PREFIX "/sounds/squish.wav",
- DATA_PREFIX "/sounds/fall.wav",
- DATA_PREFIX "/sounds/ricochet.wav",
- DATA_PREFIX "/sounds/bump-upgrade.wav",
- DATA_PREFIX "/sounds/upgrade.wav",
- DATA_PREFIX "/sounds/excellent.wav",
- DATA_PREFIX "/sounds/coffee.wav",
- DATA_PREFIX "/sounds/shoot.wav",
- DATA_PREFIX "/sounds/lifeup.wav",
- DATA_PREFIX "/sounds/stomp.wav",
- DATA_PREFIX "/sounds/kick.wav"
- };
-
-
#ifndef NOSOUND
#include <SDL_mixer.h>
/* functions handling the sound and music */
int open_audio(int frequency, Uint16 format, int channels, int chunksize);
+void close_audio( void );
Mix_Chunk * load_sound(char * file);
-void play_sound(Mix_Chunk * snd);
+void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker);
Mix_Music * load_song(char * file);
int playing_music(void);
void free_music(Mix_Music*music);
void free_chunk(Mix_Chunk*chunk);
+void play_current_music(void);
+
#else
-//fake variables
+/* fake variables */
void* sounds[NUM_SOUNDS];
void* level_song, *herring_song;
-// fake sound handlers
+/* fake sound handlers */
int open_audio (int frequency, int format, int channels, int chunksize);
+void close_audio( void );
void* load_sound(void* file);
-void play_sound(void * snd);
+void play_sound(void * snd, enum Sound_Speaker whichSpeaker);
void* load_song(void* file);
int playing_music();
void halt_music();
int play_music(void *music, int loops);
void free_music(void *music);
-;
void free_chunk(void *chunk);
+void play_current_music(void);
+
#endif
#endif /*SUPERTUX_SOUND_H*/