]> git.mxchange.org Git - flightgear.git/commitdiff
Dont execute code in case the soundmanager isn't properly initialized
authorehofman <ehofman>
Tue, 8 Sep 2009 13:51:24 +0000 (13:51 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 9 Sep 2009 06:56:32 +0000 (08:56 +0200)
src/Sound/beacon.cxx
src/Sound/fg_fx.cxx
src/Sound/morse.cxx

index 1f9d6b30612fedf2a328a085a557cbdc18d0ef9a..ad938c0c648cf4b7a59e452dff6d12dec50378ba 100644 (file)
@@ -41,6 +41,10 @@ bool FGBeacon::init() {
     int len;
     unsigned char *ptr;
 
+    if (globals->get_soundmgr()->is_working() == false) {
+       return false;
+    }
+
     unsigned char inner_buf[ INNER_SIZE ] ;
     unsigned char middle_buf[ MIDDLE_SIZE ] ;
     unsigned char outer_buf[ OUTER_SIZE ] ;
index cb78616e891d921bb5aa5fdec8099bd56bc137ef..caff002e224a8e41a9754cb32040e254877e2517 100644 (file)
@@ -202,13 +202,12 @@ FGFX::play_message( SGSoundSample *_sample )
 void
 FGFX::play_message( const string path, const string fname, double volume )
 {
-    if (globals->get_soundmgr()->is_working() == false) {
-        return;
+    if (globals->get_soundmgr()->is_working() == true) {
+        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
index 674fa991a0804769957b474121588c72f9b8bfcd..92b671bca4471ee7def602724f47361f756c8af3 100644 (file)
@@ -167,6 +167,11 @@ bool FGMorse::cust_init(const int freq ) {
 
 // make a SGSoundSample morse code transmission for the specified string
 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();
 
     int length = 0;