#endif
#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); }
-inline int (isnan)(double r) { return isnan(r); }
+# ifdef __GNUC__
+# if ( __GNUC__ >= 3 ) && ( __GNUC_MINOR__ >= 3 )
+// # include <math.h>
+inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
+# else
+ // any C++ header file undefines isinf and isnan
+ // so this should be included before <iostream>
+ // the functions are STILL in libm (libSystem on mac os x)
+extern "C" int isnan (double);
+extern "C" int isinf (double);
+# endif
+# else
+// inline int (isinf)(double r) { return isinf(r); }
+// inline int (isnan)(double r) { return isnan(r); }
+# endif
#endif
#if defined (__FreeBSD__)
SG_LOG( SG_GENERAL, SG_INFO, "Initializing OpenAL sound manager" );
// initialize OpenAL
+#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
+ if (!alutInit(NULL, NULL))
+ {
+ ALenum error = alutGetError ();
+ SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
+ SG_LOG( SG_GENERAL, SG_ALERT, " "+string(alutGetErrorString(error)));
+ working = false;
+ }
+ context = alcGetCurrentContext();
+#else
if ( (dev = alcOpenDevice( NULL )) != NULL
&& ( context = alcCreateContext( dev, NULL )) != NULL ) {
working = true;
context = 0;
SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
}
+#endif
listener_pos[0] = 0.0;
listener_pos[1] = 0.0;
SGSoundMgr::~SGSoundMgr() {
+#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
+ alutExit ();
+#else
if (context)
alcDestroyContext( context );
+#endif
//
// Remove the samples from the sample manager.
//