[Tuxracer-checkins] CVS: tuxracer/src audio.c,1.4,1.5
Status: Beta
Brought to you by:
jfpatry
From: Jasmin P. <jf...@us...> - 2000-09-02 17:15:30
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv5696 Modified Files: audio.c Log Message: play_sound, play_music, and update_audio now make sure the audio device is open before doing anything. Index: audio.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/audio.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** audio.c 2000/08/23 22:59:19 1.4 --- audio.c 2000/09/02 17:15:26 1.5 *************** *** 66,69 **** --- 66,86 ---- } + + /*! + Returns the status of the audio device + \return True if audio has been opened, False otherwise + \author jfpatry + \date Created: 2000-09-02 + \date Modified: 2000-09-02 + */ + bool_t is_audio_open() + { + int tmp_freq; + Uint16 tmp_format; + int tmp_channels; + + return (bool_t) Mix_QuerySpec( &tmp_freq, &tmp_format, &tmp_channels ); + } + /*! Associate the sounds in the _name_ array with the *************** *** 350,354 **** \author jfpatry \date Created: 2000-08-13 ! \date Modified: 2000-08-13 */ bool_t play_sound( char *sound_context ) --- 367,371 ---- \author jfpatry \date Created: 2000-08-13 ! \date Modified: 2000-09-02 */ bool_t play_sound( char *sound_context ) *************** *** 362,365 **** --- 379,386 ---- } + if ( ! is_audio_open() ) { + return False; + } + check_assertion( sound_context != NULL, "sound_context is null" ); *************** *** 386,390 **** \author jfpatry \date Created: 2000-08-13 ! \date Modified: 2000-08-14 */ bool_t play_music( char *music_context ) --- 407,411 ---- \author jfpatry \date Created: 2000-08-13 ! \date Modified: 2000-09-02 */ bool_t play_music( char *music_context ) *************** *** 400,403 **** --- 421,428 ---- } + if ( ! is_audio_open() ) { + return False; + } + if ( music_context == NULL ) { if ( current_music_name_ != NULL ) { *************** *** 441,445 **** \author jfpatry \date Created: 2000-08-14 ! \date Modified: 2000-08-14 */ void --- 466,470 ---- \author jfpatry \date Created: 2000-08-14 ! \date Modified: 2000-09-02 */ void *************** *** 449,452 **** --- 474,481 ---- check_assertion( initialized_, "audio module not initialized" ); + + if ( ! is_audio_open() ) { + return; + } if ( getparam_music_enabled() == False ) { |