Revision: 2509 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2509&view=rev Author: rorthomas Date: 2012-05-06 03:58:36 +0000 (Sun, 06 May 2012) Log Message: ----------- fix++
Modified Paths: -------------- trunk/source/main/audio/SoundManager.cpp Modified: trunk/source/main/audio/SoundManager.cpp =================================================================== --- trunk/source/main/audio/SoundManager.cpp 2012-05-06 03:47:45 UTC (rev 2508) +++ trunk/source/main/audio/SoundManager.cpp 2012-05-06 03:58:36 UTC (rev 2509) @@ -29,18 +29,19 @@ #endif // OGRE_PLATFORM_LINUX -int _checkALErrors(int linenum) +bool _checkALErrors(const char *filename, int linenum) { int err = alGetError(); if(err != AL_NO_ERROR) { char buf[4096]=""; - sprintf(buf, "OpenAL Error: %s (0x%x), @ %d\n", alGetString(err), err, linenum); + sprintf(buf, "OpenAL Error: %s (0x%x), @ %s:%d\n", alGetString(err), err, filename, linenum); LOG(buf); + return true; } - return err; + return false; } -#define checkALErrors() _checkALErrors(__LINE__) +#define hasALErrors() _checkALErrors(__FILE__, __LINE__) using namespace Ogre; @@ -65,15 +66,29 @@ const char *alDeviceString = audio_device.c_str(); if(audio_device == "Default") alDeviceString = NULL; m_sound_device = alcOpenDevice(alDeviceString); - if(checkALErrors()) + if(!m_sound_device) + { + hasALErrors(); return; + } + m_sound_context = alcCreateContext(m_sound_device, NULL); + + if (!m_sound_context) + { + ALint error= alGetError(); + LOG("SoundManager: Could not create OpenAL context, error code: " + TOSTRING(error)); + alcCloseDevice(m_sound_device); + m_sound_device = NULL; + return; + } + const char *tmp = alGetString(AL_VENDOR); if(tmp) LOG("OpenAL vendor is: " + String(tmp)); - + tmp = alGetString(AL_VERSION); if(tmp) LOG("OpenAL version is: " + String(tmp)); - + tmp = alGetString(AL_RENDERER); if(tmp) LOG("OpenAL renderer is: " + String(tmp)); @@ -85,17 +100,7 @@ tmp = alcGetString(m_sound_device, ALC_EXTENSIONS); if(tmp) LOG("OpenAL ALC extensions are: " + String(tmp)); - - m_sound_context = alcCreateContext(m_sound_device, NULL); - if (!m_sound_context) - { - ALint error= alGetError(); - LOG("SoundManager: Could not create OpenAL context, error code: " + TOSTRING(error)); - alcCloseDevice(m_sound_device); - m_sound_device = NULL; - return; - } alcMakeContextCurrent(m_sound_context); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel