]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/openal_test1.cxx
Add a HLADataElementVisitor implementation.
[simgear.git] / simgear / sound / openal_test1.cxx
index dd2a77f01620e813c6ba6b1026bf4518719557e9..0a6dc885a2961584d79977acc092d612d3f4ae03 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,7 @@ int main( int argc, char *argv[] ) {
     ALCdevice *dev;
     ALCcontext *context;
 
+    alutInit(&argc, argv);
     sglog().setLogLevels( SG_ALL, SG_ALERT );
 
     // initialize OpenAL
@@ -103,10 +103,6 @@ int main( int argc, char *argv[] ) {
     ALfloat source_vel[3];
 
     // configuration values
-//    ALenum format;
-//    ALsizei size;
-//    ALvoid* data;
-//    ALsizei freq;
     ALboolean loop = false;
 
     source_pos[0] = 0.0; source_pos[1] = 0.0; source_pos[2] = 0.0;
@@ -131,6 +127,11 @@ int main( int argc, char *argv[] ) {
   }
 
 #else
+  ALenum format;
+  ALsizei size;
+  ALvoid* data;
+  ALsizei freq;
+  
 # if defined (__APPLE__)
     alutLoadWAVFile( (ALbyte *)AUDIOFILE, &format, &data, &size, &freq );
 # else
@@ -164,6 +165,7 @@ int main( int argc, char *argv[] ) {
     alSourcePlay( source );
 
     sleep(10);
+    alutExit();
 
     return 0;
 }