_geod_pos(SGGeod::fromCart(SGVec3d::zeros())),
_velocity(SGVec3d::zeros()),
_orientation(SGQuatd::zeros()),
- _devname(NULL),
_bad_doppler(false)
{
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
}
// initialize the sound manager
-void SGSoundMgr::init() {
+void SGSoundMgr::init(const char *devname) {
SG_LOG( SG_GENERAL, SG_INFO, "Initializing OpenAL sound manager" );
- ALCdevice *device = alcOpenDevice(_devname);
- if ( testForError(device, "No default audio device available.") ) {
- return;
+ ALCdevice *device = alcOpenDevice(devname);
+ if ( testForError(device, "Audio device not available, trying default") ) {
+ ALCdevice *device = alcOpenDevice(NULL);
+ if (testForError(device, "Default Audio device not available.") ) {
+ return;
+ }
}
ALCcontext *context = alcCreateContext(device, NULL);
SGSoundMgr();
~SGSoundMgr();
- void init();
+ void init(const char *devname = NULL);
void bind();
void unbind();
void update(double dt);
vector<ALuint> _free_sources;
vector<ALuint> _sources_in_use;
- char *_devname;
bool _bad_doppler;
bool testForALError(string s);