Add support for the MacOS variations of OpenAL.

This commit is contained in:
curt 2004-04-25 01:48:08 +00:00
parent db8d961b27
commit cc43c745b2
6 changed files with 47 additions and 10 deletions

View File

@ -21,7 +21,7 @@ noinst_PROGRAMS = openal_test1 openal_test2
openal_test1_SOURCES = openal_test1.cxx openal_test1_SOURCES = openal_test1.cxx
openal_test2_SOURCES = openal_test2.cxx openal_test2_SOURCES = openal_test2.cxx
openal_test1_LDADD = -lsgdebug -lopenal openal_test1_LDADD = -lsgdebug $(openal_LIBS)
openal_test2_LDADD = \ openal_test2_LDADD = \
$(top_builddir)/simgear/sound/libsgsound.a \ $(top_builddir)/simgear/sound/libsgsound.a \
-lsgdebug -lsgmisc -lsgstructure $(openal_LIBS) -lsgdebug -lsgmisc -lsgstructure $(openal_LIBS)

View File

@ -1,7 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include <AL/al.h> #if defined( __APPLE__ )
#include <AL/alut.h> # define AL_ILLEGAL_ENUM AL_INVALID_ENUM
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h>
# include <OpenAL/alut.h>
#else
# include <AL/al.h>
# include <AL/alut.h>
#endif
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>

View File

@ -21,8 +21,15 @@
// $Id$ // $Id$
#include <AL/al.h> #if defined( __APPLE__ )
#include <AL/alut.h> # define AL_ILLEGAL_ENUM AL_INVALID_ENUM
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h>
# include <OpenAL/alut.h>
#else
# include <AL/al.h>
# include <AL/alut.h>
#endif
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
@ -86,8 +93,13 @@ SGSoundSample::SGSoundSample( const char *path, const char *file ) :
} }
// Load the sample file // Load the sample file
#if defined (__APPLE__)
alutLoadWAVFile( (ALbyte *)samplepath.c_str(),
&format, &data, &size, &freq );
#else
alutLoadWAVFile( (ALbyte *)samplepath.c_str(), alutLoadWAVFile( (ALbyte *)samplepath.c_str(),
&format, &data, &size, &freq, &loop ); &format, &data, &size, &freq, &loop );
#endif
if (alGetError() != AL_NO_ERROR) { if (alGetError() != AL_NO_ERROR) {
throw sg_exception("Failed to load wav file."); throw sg_exception("Failed to load wav file.");
} }

View File

@ -34,7 +34,15 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <AL/al.h> #if defined(__APPLE__)
# define AL_ILLEGAL_ENUM AL_INVALID_ENUM
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h>
# include <OpenAL/alut.h>
#else
# include <AL/al.h>
# include <AL/alut.h>
#endif
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>

View File

@ -25,9 +25,15 @@
#include <iostream> #include <iostream>
#include <AL/al.h> #if defined(__APPLE__)
#include <AL/alut.h> # include <OpenAL/al.h>
#include <AL/alc.h> # include <OpenAL/alut.h>
# include <OpenAL/alc.h>
#else
# include <AL/al.h>
# include <AL/alut.h>
# include <AL/alc.h>
#endif
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>

View File

@ -42,7 +42,11 @@
#include STL_STRING #include STL_STRING
#include <map> #include <map>
#include <AL/al.h> #if defined( __APPLE__ )
# include <OpenAL/al.h>
#else
# include <AL/al.h>
#endif
#include "sample_openal.hxx" #include "sample_openal.hxx"