Make openal works on linux

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2805 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-03-30 17:24:55 +00:00
parent 6b2b1a34ee
commit 58a78cb2b5
4 changed files with 23 additions and 10 deletions

View File

@ -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'])

View File

@ -21,17 +21,18 @@
#include "SoundStream.h"
#include "Thread.h"
//#include <list>
//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

View File

@ -4,6 +4,7 @@ Import('env')
files = [
'AOSoundStream.cpp',
'aldlist.cpp',
'AudioCommonConfig.cpp',
'OpenALStream.cpp',
'WaveFile.cpp',

View File

@ -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;
}
}