From: ehofman Date: Mon, 4 Jul 2005 09:20:11 +0000 (+0000) Subject: Make sure it works with the lates version of OpenAL. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=be309603667c3f00b7d6a3b2fbfd5db33b2ae878;p=simgear.git Make sure it works with the lates version of OpenAL. --- diff --git a/simgear/sound/openal_test1.cxx b/simgear/sound/openal_test1.cxx index 5d56bc9e..e94391e3 100644 --- a/simgear/sound/openal_test1.cxx +++ b/simgear/sound/openal_test1.cxx @@ -12,9 +12,11 @@ static unsigned int sleep(unsigned int secs) { return 0; } # define AL_ILLEGAL_ENUM AL_INVALID_ENUM # define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION # include +# include # include #else # include +# include # include #endif @@ -39,10 +41,16 @@ static void print_openal_error( ALuint error ) { int main( int argc, char *argv[] ) { // initialize OpenAL - alutInit( 0, NULL ); - alGetError(); - if ( alGetError() != AL_NO_ERROR) { - SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" ); + ALCdevice *dev; + ALCcontext *context; + + // initialize OpenAL + if ( (dev = alcOpenDevice( NULL )) != NULL + && ( context = alcCreateContext( dev, NULL )) != NULL ) { + alcMakeContextCurrent( context ); + } else { + context = 0; + SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" ); } // Position of the listener.