1
0
Fork 0

Dont execute code in case the soundmanager isn't properly initialized

This commit is contained in:
ehofman 2009-09-08 13:51:24 +00:00 committed by Tim Moore
parent 80e67b17c2
commit e8db3a514a
3 changed files with 14 additions and 6 deletions

View file

@ -41,6 +41,10 @@ bool FGBeacon::init() {
int len; int len;
unsigned char *ptr; unsigned char *ptr;
if (globals->get_soundmgr()->is_working() == false) {
return false;
}
unsigned char inner_buf[ INNER_SIZE ] ; unsigned char inner_buf[ INNER_SIZE ] ;
unsigned char middle_buf[ MIDDLE_SIZE ] ; unsigned char middle_buf[ MIDDLE_SIZE ] ;
unsigned char outer_buf[ OUTER_SIZE ] ; unsigned char outer_buf[ OUTER_SIZE ] ;

View file

@ -202,13 +202,12 @@ FGFX::play_message( SGSoundSample *_sample )
void void
FGFX::play_message( const string path, const string fname, double volume ) FGFX::play_message( const string path, const string fname, double volume )
{ {
if (globals->get_soundmgr()->is_working() == false) { if (globals->get_soundmgr()->is_working() == true) {
return; SGSoundSample *sample;
sample = new SGSoundSample( path.c_str(), fname.c_str() );
sample->set_volume( volume );
play_message( sample );
} }
SGSoundSample *sample;
sample = new SGSoundSample( path.c_str(), fname.c_str() );
sample->set_volume( volume );
play_message( sample );
} }
void void

View file

@ -167,6 +167,11 @@ bool FGMorse::cust_init(const int freq ) {
// make a SGSoundSample morse code transmission for the specified string // make a SGSoundSample morse code transmission for the specified string
SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) { SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) {
if (globals->get_soundmgr()->is_working() == false) {
return 0;
}
char *idptr = (char *)id.c_str(); char *idptr = (char *)id.c_str();
int length = 0; int length = 0;