]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/openal_test1.cxx
Introduce "PRESERVE" flag to protect properties on sim reset.
[simgear.git] / simgear / sound / openal_test1.cxx
index 94e3e4510303d2b0a6cc1daac69244f9131f55ea..3d055b00104d72cf7111e3e56ba68f44a234c1c8 100644 (file)
@@ -1,9 +1,8 @@
 #include <stdio.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; }
+#ifdef _WIN32
+#include <windows.h>
+#define sleep(x) Sleep(x*1000)
 #else
 #include <unistd.h>    // sleep()
 #endif
@@ -13,7 +12,7 @@ static unsigned int sleep(unsigned int secs) { return 0; }
 # define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
 # include <OpenAL/al.h>
 # include <OpenAL/alc.h>
-# include <OpenAL/alut.h>
+# include <ALUT/alut.h>
 #elif defined(OPENALSDK)
 # include <al.h>
 # include <alc.h>
@@ -50,6 +49,9 @@ int main( int argc, char *argv[] ) {
     ALCdevice *dev;
     ALCcontext *context;
 
+    alutInit(&argc, argv);
+    sglog().setLogLevels( SG_ALL, SG_ALERT );
+
     // initialize OpenAL
     if ( (dev = alcOpenDevice( NULL )) != NULL
             && ( context = alcCreateContext( dev, NULL )) != NULL ) {
@@ -162,6 +164,7 @@ int main( int argc, char *argv[] ) {
     alSourcePlay( source );
 
     sleep(10);
+    alutExit();
 
     return 0;
 }