X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsound%2Fopenal_test1.cxx;h=0a6dc885a2961584d79977acc092d612d3f4ae03;hb=be7065674586ffbb5940ab21a028bc8c461217e2;hp=687df455f528df086c204dedb8d3da77523e6e90;hpb=6fe14f7a6b2cc048835add0d2d3e95e36322f1b3;p=simgear.git diff --git a/simgear/sound/openal_test1.cxx b/simgear/sound/openal_test1.cxx index 687df455..0a6dc885 100644 --- a/simgear/sound/openal_test1.cxx +++ b/simgear/sound/openal_test1.cxx @@ -1,9 +1,8 @@ #include -#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 +#define sleep(x) Sleep(x*1000) #else #include // sleep() #endif @@ -13,7 +12,11 @@ static unsigned int sleep(unsigned int secs) { return 0; } # define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION # include # include -# include +# include +#elif defined(OPENALSDK) +# include +# include +# include #else # include # include @@ -46,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 ) { @@ -97,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; @@ -125,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 @@ -158,6 +165,7 @@ int main( int argc, char *argv[] ) { alSourcePlay( source ); sleep(10); + alutExit(); return 0; }