]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/openal_test1.cxx
Update the code a bit more, add a function to retreive the last error string and...
[simgear.git] / simgear / sound / openal_test1.cxx
index 91b8c84958a6ea3a93650d358684187f7bf9de2f..5d56bc9e83222ae9df692ad0faa3b61a876b108d 100644 (file)
@@ -1,7 +1,22 @@
 #include <stdio.h>
 
-#include <AL/al.h>
-#include <AL/alut.h>
+#ifdef __MINGW32__
+// This is broken, but allows the file to compile without a POSIX
+// environment.
+static unsigned int sleep(unsigned int secs) { return 0; }
+#else
+#include <unistd.h>    // sleep()
+#endif
+
+#if defined( __APPLE__ )
+# define AL_ILLEGAL_ENUM AL_INVALID_ENUM
+# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
+# include <OpenAL/al.h>
+# include <OpenAL/alut.h>
+#else
+# include <AL/al.h>
+# include <AL/alut.h>
+#endif
 
 #include <simgear/debug/logstream.hxx>
 
@@ -92,7 +107,11 @@ int main( int argc, char *argv[] ) {
     }
 
     // Load the sample file
+#if defined (__APPLE__)
+    alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq );
+#else
     alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq, &loop );
+#endif
     if (alGetError() != AL_NO_ERROR) {
         SG_LOG( SG_GENERAL, SG_ALERT, "Failed to load wav file.");
     }