int current_music;
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"
+ "/sounds/jump.wav",
+ "/sounds/bigjump.wav",
+ "/sounds/skid.wav",
+ "/sounds/distro.wav",
+ "/sounds/herring.wav",
+ "/sounds/brick.wav",
+ "/sounds/hurt.wav",
+ "/sounds/squish.wav",
+ "/sounds/fall.wav",
+ "/sounds/ricochet.wav",
+ "/sounds/bump-upgrade.wav",
+ "/sounds/upgrade.wav",
+ "/sounds/excellent.wav",
+ "/sounds/coffee.wav",
+ "/sounds/shoot.wav",
+ "/sounds/lifeup.wav",
+ "/sounds/stomp.wav",
+ "/sounds/kick.wav"
};
-#ifndef NOSOUND
-
#include <SDL_mixer.h>
Mix_Chunk * sounds[NUM_SOUNDS];
void close_audio( void )
{
- if (audio_device == YES) {
+ if (audio_device) {
Mix_UnregisterAllEffects( SOUND_LEFT_SPEAKER );
Mix_UnregisterAllEffects( SOUND_RIGHT_SPEAKER );
Mix_CloseAudio();
/* --- LOAD A SOUND --- */
-Mix_Chunk * load_sound(char * file)
+Mix_Chunk * load_sound(const std::string& file)
{
Mix_Chunk * snd;
- snd = Mix_LoadWAV(file);
+ snd = Mix_LoadWAV(file.c_str());
/* printf message and abort if there is an initialized audio device */
- if ((snd == NULL) && (audio_device == YES))
+ if ((snd == NULL) && audio_device)
st_abort("Can't load", file);
return(snd);
/* --- LOAD A SONG --- */
-Mix_Music * load_song(char * file)
+Mix_Music * load_song(const std::string& file)
{
Mix_Music * sng;
- sng = Mix_LoadMUS(file);
+ sng = Mix_LoadMUS(file.c_str());
/* printf message and abort if there is an initialized audio device */
- if ((sng == NULL) && (audio_device == YES))
+ if ((sng == NULL) && audio_device)
st_abort("Can't load", file);
return (sng);
}
/* this won't call the function if the user has disabled sound
* either via menu or via command-line option
*/
- if ((use_sound == YES) && (audio_device == YES))
+ if ((use_sound == true) && (audio_device == true))
{
Mix_PlayChannel( whichSpeaker, snd, 0);
int playing_music(void)
{
- if (use_music == YES)
+ if (use_music == true)
{
return Mix_PlayingMusic();
}
int halt_music(void)
{
- if ((use_music == YES) && (audio_device == YES))
+ if ((use_music == true) && (audio_device == true))
{
return Mix_HaltMusic();
}
int play_music(Mix_Music *music, int loops)
{
- if ((use_music == YES) && (audio_device == YES))
+ if ((use_music == true) && (audio_device == true))
{
DEBUG_MSG(__PRETTY_FUNCTION__);
return Mix_PlayMusic(music, loops);
/* use halt_music whenever you want to stop it */
}
-#else
-
-void* sounds[NUM_SOUNDS];
-void* level_song, * level_song_fast, * herring_song;
-
-int open_audio (int frequency, int format, int channels, int chunksize)
-{
- return -1;
-}
-
-
-void close_audio(void)
-{}
-
-
-void* load_sound(void* file)
-{
- return NULL;
-}
-
-
-void play_sound(void * snd, enum Sound_Speaker whichSpeaker)
-{}
-
-
-void* load_song(void* file)
-{
- return NULL;
-}
-
-
-int playing_music()
-{
- return 0;
-}
-
-
-void halt_music()
-{}
-
-
-int play_music(void *music, int loops)
-{
- return 0;
-}
-
-
-void free_music(void *music)
-{}
-
-
-void free_chunk(void *chunk)
-{}
-
-int get_current_music()
-{
-}
-
-void set_current_music(int music)
-{
-}
-
-void play_current_music(void)
-{}
-
-#endif