From 58a78cb2b59aa7a2858467b0c29f75962ab1979c Mon Sep 17 00:00:00 2001 From: nakeee Date: Mon, 30 Mar 2009 17:24:55 +0000 Subject: [PATCH] Make openal works on linux git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2805 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 4 ++++ Source/Core/AudioCommon/Src/OpenALStream.h | 15 +++++++++++---- Source/Core/AudioCommon/Src/SConscript | 1 + Source/Core/AudioCommon/Src/aldlist.cpp | 13 +++++++------ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/SConstruct b/SConstruct index 4aefc6f223..15e3e44e3c 100644 --- a/SConstruct +++ b/SConstruct @@ -236,6 +236,9 @@ env['HAVE_BLUEZ'] = conf.CheckPKG('bluez') # needed for sound env['HAVE_AO'] = conf.CheckPKG('ao') +# Sound lib +env['HAVE_OPENAL'] = conf.CheckPKG('openal') + # needed for mic env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) @@ -304,6 +307,7 @@ conf.Define('HAVE_SDL', env['HAVE_SDL']) conf.Define('USE_SDL', env['USE_SDL']) conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ']) conf.Define('HAVE_AO', env['HAVE_AO']) +conf.Define('HAVE_OPENAL', env['HAVE_OPENAL']) conf.Define('HAVE_WX', env['HAVE_WX']) conf.Define('USE_WX', env['USE_WX']) conf.Define('HAVE_X11', env['HAVE_X11']) diff --git a/Source/Core/AudioCommon/Src/OpenALStream.h b/Source/Core/AudioCommon/Src/OpenALStream.h index 9398474d58..a02e597399 100644 --- a/Source/Core/AudioCommon/Src/OpenALStream.h +++ b/Source/Core/AudioCommon/Src/OpenALStream.h @@ -21,17 +21,18 @@ #include "SoundStream.h" #include "Thread.h" -//#include -//using namespace std; - +#ifdef HAVE_OPENAL && HAVE_OPENAL #include "../../../../Externals/OpenAL/include/al.h" #include "../../../../Externals/OpenAL/include/alc.h" // public use #define SFX_MAX_SOURCE 1 +#endif + class OpenALStream: public SoundStream { +#ifdef HAVE_OPENAL && HAVE_OPENAL public: OpenALStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {}; virtual ~OpenALStream() {}; @@ -49,6 +50,12 @@ private: Common::Thread *thread; Common::CriticalSection soundCriticalSection; Common::Event soundSyncEvent; +#else + OpenALStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {} +#endif // HAVE_OPENAL }; -#endif + + + +#endif // OPENALSTREAM diff --git a/Source/Core/AudioCommon/Src/SConscript b/Source/Core/AudioCommon/Src/SConscript index 2f64311a41..4d493c8a26 100644 --- a/Source/Core/AudioCommon/Src/SConscript +++ b/Source/Core/AudioCommon/Src/SConscript @@ -4,6 +4,7 @@ Import('env') files = [ 'AOSoundStream.cpp', + 'aldlist.cpp', 'AudioCommonConfig.cpp', 'OpenALStream.cpp', 'WaveFile.cpp', diff --git a/Source/Core/AudioCommon/Src/aldlist.cpp b/Source/Core/AudioCommon/Src/aldlist.cpp index 7c6b0eeec9..46e910dc59 100644 --- a/Source/Core/AudioCommon/Src/aldlist.cpp +++ b/Source/Core/AudioCommon/Src/aldlist.cpp @@ -22,6 +22,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "Common.h" #include "aldlist.h" #include "../../../../Externals/OpenAL/include/al.h" #include "../../../../Externals/OpenAL/include/alc.h" @@ -51,7 +52,7 @@ ALDeviceList::ALDeviceList() defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) - while (*devices != NULL) { + while (devices != NULL) { if (strcmp(defaultDeviceName, devices) == 0) { defaultDeviceIndex = index; } @@ -191,7 +192,7 @@ bool ALDeviceList::IsExtensionSupported(s32 index, char *szExtName) if (index < GetNumDevices()) { for (u32 i = 0; i < vDeviceInfo[index].pvstrExtensions->size(); i++) { - if (!_stricmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) { + if (!strcasecmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) { bReturn = true; break; } @@ -214,7 +215,7 @@ s32 ALDeviceList::GetDefaultDevice() */ void ALDeviceList::FilterDevicesMinVer(s32 major, s32 minor) { - s32 dMajor, dMinor; + s32 dMajor = 0, dMinor = 0; for (u32 i = 0; i < vDeviceInfo.size(); i++) { GetDeviceVersion(i, &dMajor, &dMinor); if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) { @@ -228,7 +229,7 @@ void ALDeviceList::FilterDevicesMinVer(s32 major, s32 minor) */ void ALDeviceList::FilterDevicesMaxVer(s32 major, s32 minor) { - s32 dMajor, dMinor; + s32 dMajor = 0, dMinor = 0; for (u32 i = 0; i < vDeviceInfo.size(); i++) { GetDeviceVersion(i, &dMajor, &dMinor); if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) { @@ -247,7 +248,7 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName) for (u32 i = 0; i < vDeviceInfo.size(); i++) { bFound = false; for (u32 j = 0; j < vDeviceInfo[i].pvstrExtensions->size(); j++) { - if (!_stricmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) { + if (!strcasecmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) { bFound = true; break; } @@ -330,4 +331,4 @@ u32 ALDeviceList::GetMaxNumSources() } return iSourceCount; -} \ No newline at end of file +}