]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/soundmgr_openal.cxx
Melchior FRANZ:
[simgear.git] / simgear / sound / soundmgr_openal.cxx
index 8bb70480a489fe50c80b6182ca1b0c50ebd2d15b..b525b31fb4f9a531c08027c54b22650796f805cc 100644 (file)
@@ -5,7 +5,7 @@
 //
 // C++-ified by Curtis Olson, started March 2001.
 //
-// Copyright (C) 2001  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -35,7 +35,7 @@
 # include <AL/alc.h>
 #endif
 
-#if defined (__APPLE__) 
+#if defined (__APPLE__)
 // any C++ header file undefines isinf and isnan
 // so this should be included before <iostream>
 inline int (isinf)(double r) { return isinf(r); }
@@ -46,6 +46,10 @@ inline int (isnan)(double r) { return isnan(r); }
 #define isnan(x) _isnan(x)
 #endif
 
+#if defined (__FreeBSD__)
+inline int isnan(double r) { return !(r < 0 || r > 0); }
+#endif
+
 #include STL_IOSTREAM
 
 #include <simgear/debug/logstream.hxx>
@@ -61,11 +65,12 @@ inline int (isnan)(double r) { return isnan(r); }
 // constructor
 SGSoundMgr::SGSoundMgr() {
 
-    SG_LOG( SG_GENERAL, SG_ALERT, "Initializing OpenAL sound manager" );
+    SG_LOG( SG_GENERAL, SG_INFO, "Initializing OpenAL sound manager" );
 
     // initialize OpenAL
     alutInit( 0, NULL );
-    alGetError();
+    atexit(alutExit);
+
     if ( alGetError() == AL_NO_ERROR) {
         working = true;
     } else {
@@ -115,8 +120,6 @@ SGSoundMgr::~SGSoundMgr() {
        SGSoundSample *sample = sample_current->second;
        delete sample;
     }
-
-    alutExit();
 }