X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsound.cpp;h=173e30809b6f80486e6c37bd6bb41de0a21e0810;hb=36cc92dc67c4cfdaceed7d47a4aa6992b407d1df;hp=9863eaf672bae8c235f0374d04b6383126354baa;hpb=b76c9452394e9c8a11a6451bb2c14e86668b679c;p=supertux.git diff --git a/src/sound.cpp b/src/sound.cpp index 9863eaf67..173e30809 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -43,8 +43,6 @@ char * soundfilenames[NUM_SOUNDS] = { }; -#ifndef NOSOUND - #include Mix_Chunk * sounds[NUM_SOUNDS]; @@ -79,7 +77,7 @@ int open_audio (int frequency, Uint16 format, int channels, int chunksize) void close_audio( void ) { - if (audio_device == YES) { + if (audio_device) { Mix_UnregisterAllEffects( SOUND_LEFT_SPEAKER ); Mix_UnregisterAllEffects( SOUND_RIGHT_SPEAKER ); Mix_CloseAudio(); @@ -96,8 +94,8 @@ Mix_Chunk * load_sound(const std::string& file) snd = Mix_LoadWAV(file.c_str()); /* printf message and abort if there is an initialized audio device */ - if ((snd == NULL) && (audio_device == YES)) - st_abort("Can't load", file.c_str()); + if ((snd == NULL) && audio_device) + st_abort("Can't load", file); return(snd); } @@ -112,8 +110,8 @@ Mix_Music * load_song(const std::string& file) sng = Mix_LoadMUS(file.c_str()); /* printf message and abort if there is an initialized audio device */ - if ((sng == NULL) && (audio_device == YES)) - st_abort("Can't load", file.c_str()); + if ((sng == NULL) && audio_device) + st_abort("Can't load", file); return (sng); } @@ -125,7 +123,7 @@ void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker) /* 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); @@ -158,7 +156,7 @@ void free_chunk(Mix_Chunk *chunk) int playing_music(void) { - if (use_music == YES) + if (use_music == true) { return Mix_PlayingMusic(); } @@ -172,7 +170,7 @@ int playing_music(void) int halt_music(void) { - if ((use_music == YES) && (audio_device == YES)) + if ((use_music == true) && (audio_device == true)) { return Mix_HaltMusic(); } @@ -185,7 +183,7 @@ int halt_music(void) 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); @@ -240,69 +238,3 @@ void free_music(Mix_Music *music) /* 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