Following discussion with Tat and Erik, update how we handle ALUT on Mac; specifically, switch to using an ALUT.framework built from FreeALUT. The ALUT framework is available (initially) from:

http://files.goneabitbursar.com/fg/alut-osx-universal.zip

for testing purposes; autoconf integration and an official home for the
framework will follow once this approach has been tested and confirmed as
sane by other Mac developers!
This commit is contained in:
jmt
2010-05-05 09:05:23 +02:00
committed by Tim Moore
parent 229abb8412
commit 8962d9b293
2 changed files with 26 additions and 33 deletions
+10 -1
View File
@@ -30,7 +30,7 @@
#endif #endif
#if defined( __APPLE__ ) #if defined( __APPLE__ )
# include <OpenAL/alut.h> # include <ALUT/alut.h>
#else #else
# include <AL/alut.h> # include <AL/alut.h>
#endif #endif
@@ -45,10 +45,17 @@
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
using std::string;
extern bool isNaN(float *v); extern bool isNaN(float *v);
#define MAX_SOURCES 128 #define MAX_SOURCES 128
#ifndef ALC_ALL_DEVICES_SPECIFIER
# define ALC_ALL_DEVICES_SPECIFIER 0x1013
#endif
// //
// Sound Manager // Sound Manager
// //
@@ -81,6 +88,8 @@ SGSoundMgr::SGSoundMgr() :
} }
} }
_alut_init++; _alut_init++;
#else
#error ALUT 1.1 required, ALUT 1.0 is no longer supported, please upgrade
#endif #endif
} }
+16 -32
View File
@@ -35,32 +35,19 @@
#ifndef _SG_SOUNDMGR_OPENAL_HXX #ifndef _SG_SOUNDMGR_OPENAL_HXX
#define _SG_SOUNDMGR_OPENAL_HXX 1 #define _SG_SOUNDMGR_OPENAL_HXX 1
#ifndef __cplusplus
# error This library requires C++
#endif
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#if defined(__APPLE__) #if defined(__APPLE__)
# define AL_ILLEGAL_ENUM AL_INVALID_ENUM
# define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
# include <OpenAL/al.h> # include <OpenAL/al.h>
# include <OpenAL/alc.h> # include <OpenAL/alc.h>
# include <OpenAL/alut.h>
#elif defined(OPENALSDK) #elif defined(OPENALSDK)
# include <al.h> # include <al.h>
# include <alc.h> # include <alc.h>
# include <AL/alut.h>
#else #else
# include <AL/al.h> # include <AL/al.h>
# include <AL/alc.h> # include <AL/alc.h>
# include <AL/alut.h>
#endif
#ifndef ALC_ALL_DEVICES_SPECIFIER
# define ALC_ALL_DEVICES_SPECIFIER 0x1013
#endif #endif
#include <simgear/compiler.h> #include <simgear/compiler.h>
@@ -68,9 +55,6 @@
#include <simgear/math/SGMathFwd.hxx> #include <simgear/math/SGMathFwd.hxx>
#include "sample_group.hxx" #include "sample_group.hxx"
#include "sample_openal.hxx"
using std::string;
struct refUint { struct refUint {
unsigned int refctr; unsigned int refctr;
@@ -81,11 +65,11 @@ struct refUint {
~refUint() {}; ~refUint() {};
}; };
typedef std::map < string, refUint > buffer_map; typedef std::map < std::string, refUint > buffer_map;
typedef buffer_map::iterator buffer_map_iterator; typedef buffer_map::iterator buffer_map_iterator;
typedef buffer_map::const_iterator const_buffer_map_iterator; typedef buffer_map::const_iterator const_buffer_map_iterator;
typedef std::map < string, SGSharedPtr<SGSampleGroup> > sample_group_map; typedef std::map < std::string, SGSharedPtr<SGSampleGroup> > sample_group_map;
typedef sample_group_map::iterator sample_group_map_iterator; typedef sample_group_map::iterator sample_group_map_iterator;
typedef sample_group_map::const_iterator const_sample_group_map_iterator; typedef sample_group_map::const_iterator const_sample_group_map_iterator;
@@ -133,21 +117,21 @@ public:
* @param refname Reference name of the sample group * @param refname Reference name of the sample group
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
bool add( SGSampleGroup *sgrp, const string& refname ); bool add( SGSampleGroup *sgrp, const std::string& refname );
/** /**
* Remove a sample group from the sound manager. * Remove a sample group from the sound manager.
* @param refname Reference name of the sample group to remove * @param refname Reference name of the sample group to remove
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
bool remove( const string& refname ); bool remove( const std::string& refname );
/** /**
* Test if a specified sample group is registered at the sound manager * Test if a specified sample group is registered at the sound manager
* @param refname Reference name of the sample group test for * @param refname Reference name of the sample group test for
* @return true if the specified sample group exists * @return true if the specified sample group exists
*/ */
bool exists( const string& refname ); bool exists( const std::string& refname );
/** /**
* Find a specified sample group in the sound manager * Find a specified sample group in the sound manager
@@ -287,13 +271,13 @@ public:
/** /**
* Get a list of available playback devices. * Get a list of available playback devices.
*/ */
vector<const char*> get_available_devices(); std::vector<const char*> get_available_devices();
/** /**
* Get the current OpenAL vendor or rendering backend. * Get the current OpenAL vendor or rendering backend.
*/ */
const string& get_vendor() { return _vendor; } const std::string& get_vendor() { return _vendor; }
const string& get_renderer() { return _renderer; } const std::string& get_renderer() { return _renderer; }
private: private:
static int _alut_init; static int _alut_init;
@@ -323,17 +307,17 @@ private:
sample_group_map _sample_groups; sample_group_map _sample_groups;
buffer_map _buffers; buffer_map _buffers;
vector<ALuint> _free_sources; std::vector<ALuint> _free_sources;
vector<ALuint> _sources_in_use; std::vector<ALuint> _sources_in_use;
bool _bad_doppler; bool _bad_doppler;
string _renderer; std::string _renderer;
string _vendor; std::string _vendor;
bool testForALError(string s); bool testForALError(std::string s);
bool testForALCError(string s); bool testForALCError(std::string s);
bool testForALUTError(string s); bool testForALUTError(std::string s);
bool testForError(void *p, string s); bool testForError(void *p, std::string s);
void update_pos_and_orientation(); void update_pos_and_orientation();
void update_sample_config( SGSampleGroup *sound ); void update_sample_config( SGSampleGroup *sound );