]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/soundmgr_openal.cxx
Ready for 0.3.8 release.
[simgear.git] / simgear / sound / soundmgr_openal.cxx
index 0785edb5a63c7193a8fe74ca15cd4ab5ae468041..bfdda68210b1e660c8e68e238890e3adb595125a 100644 (file)
@@ -42,12 +42,12 @@ inline int (isinf)(double r) { return isinf(r); }
 inline int (isnan)(double r) { return isnan(r); } 
 #endif
 
-#if defined(__MINGW32__)
-#define isnan(x) _isnan(x)
-#endif
-
 #if defined (__FreeBSD__)
-inline int isnan(double r) { return !(r < 0 || r > 0); }
+#  if __FreeBSD_version < 500000
+     extern "C" {
+       inline int isnan(double r) { return !(r <= 0 || r >= 0); }
+     }
+#  endif
 #endif
 
 #include STL_IOSTREAM
@@ -57,6 +57,9 @@ inline int isnan(double r) { return !(r < 0 || r > 0); }
 
 #include "soundmgr_openal.hxx"
 
+#if defined(__MINGW32__)
+#define isnan(x) _isnan(x)
+#endif
 
 //
 // Sound Manager
@@ -69,7 +72,8 @@ SGSoundMgr::SGSoundMgr() {
 
     // initialize OpenAL
     alutInit( 0, NULL );
-    alGetError();
+    atexit(alutExit);
+
     if ( alGetError() == AL_NO_ERROR) {
         working = true;
     } else {
@@ -92,6 +96,7 @@ SGSoundMgr::SGSoundMgr() {
     listener_ori[4] = 1.0;
     listener_ori[5] = 0.0;
 
+    alListenerf( AL_GAIN, 0.0f );
     alListenerfv( AL_POSITION, listener_pos );
     alListenerfv( AL_VELOCITY, listener_vel );
     alListenerfv( AL_ORIENTATION, listener_ori );
@@ -119,8 +124,6 @@ SGSoundMgr::~SGSoundMgr() {
        SGSoundSample *sample = sample_current->second;
        delete sample;
     }
-
-    alutExit();
 }