Detect AeonWave and if it is installed use it, otherwise fall back to OpenAL. Also let get_available_devices() use C++ strings instead of const char*
This commit is contained in:
parent
3dceaf7a0b
commit
08258ee4b3
@ -126,7 +126,7 @@ option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF)
|
||||
option(ENABLE_GDAL "Set to ON to build SimGear with GDAL support" OFF)
|
||||
option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applications" ON)
|
||||
option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON)
|
||||
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" OFF)
|
||||
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" ON)
|
||||
option(ENABLE_PKGUTIL "Set to ON to build the sg_pkgutil application (default)" ON)
|
||||
option(ENABLE_DNS "Set to ON to use udns library and DNS service resolver" ON)
|
||||
option(ENABLE_SIMD "Enable SSE/SSE2 support for x86 compilers" ON)
|
||||
@ -222,12 +222,18 @@ else()
|
||||
|
||||
if (ENABLE_SOUND)
|
||||
if (USE_AEONWAVE)
|
||||
find_package(AAX COMPONENTS aax REQUIRED)
|
||||
else()
|
||||
find_package(AAX)
|
||||
endif()
|
||||
|
||||
if(NOT AAX_FOUND)
|
||||
find_package(OpenAL REQUIRED)
|
||||
endif()
|
||||
|
||||
message(STATUS "Sound support: ENABLED")
|
||||
if(AAX_FOUND)
|
||||
message(STATUS "Sound support: AeonWave")
|
||||
else()
|
||||
message(STATUS "Sound support: OpenAL")
|
||||
endif()
|
||||
endif(ENABLE_SOUND)
|
||||
|
||||
find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgSim osgDB osgParticle osgGA osgViewer osgUtil)
|
||||
|
@ -1,14 +1,19 @@
|
||||
# Locate AAX
|
||||
# Try to find AAX (AeonWave)
|
||||
# This module defines
|
||||
# AAX_LIBRARIES
|
||||
# AAX_FOUND, if false, do not try to link to AAX
|
||||
# AAX_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# AAX_FOUND - if false, do not try to link to AAX
|
||||
# AAX_INCLUDE_DIR - where to find the headers
|
||||
# AAX_LIBRARIES - Link these to use AAX
|
||||
#
|
||||
# Copyright (C) 2016-2018 by Erik Hofman.
|
||||
# Copyright (C) 2016-2018 by Adalin B.V.
|
||||
#
|
||||
# $AAXDIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$AAXDIR
|
||||
# used in building AAX.
|
||||
#
|
||||
# Created by Erik Hofman.
|
||||
# This file is Public Domain (www.unlicense.org)
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
|
||||
FIND_PATH(AAX_INCLUDE_DIR aax/aax.h
|
||||
HINTS
|
||||
|
@ -1,20 +0,0 @@
|
||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||
|
||||
You *must* have the development components of OpenAL installed on your system
|
||||
to build FlightGear!" You can get a copy here:
|
||||
|
||||
http://connect.creativelabs.com/openal/default.aspx
|
||||
|
||||
Build notes:
|
||||
|
||||
You can download a versioned release of the openal library from
|
||||
http://www.openal.org/downloads.html. Download the openal source,
|
||||
release 0.0.8 (dated February 11, 2006) and run:
|
||||
tar xjvf openal-soft-1.5.304.tar.bz2
|
||||
cd openal-soft-1.5.304/
|
||||
ccmake .
|
||||
|
||||
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||
then press 'g' to generate and exit ]
|
||||
|
||||
|
39
README.sound
Normal file
39
README.sound
Normal file
@ -0,0 +1,39 @@
|
||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||
|
||||
For Sound support FlightGear requires one of the two following packages:
|
||||
- OpenAL
|
||||
- AeonWave
|
||||
|
||||
== OpenAL ===
|
||||
|
||||
You *must* have the development components of OpenAL installed on your system
|
||||
to build FlightGear!" You can get a copy here:
|
||||
|
||||
http://connect.creativelabs.com/openal/default.aspx
|
||||
|
||||
Build notes:
|
||||
|
||||
You can download a versioned release of the openal library from
|
||||
http://www.openal.org/downloads.html. Download the openal source,
|
||||
release 0.0.8 (dated February 11, 2006) and run:
|
||||
tar xjvf openal-soft-1.5.304.tar.bz2
|
||||
cd openal-soft-1.5.304/
|
||||
ccmake .
|
||||
|
||||
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||
then press 'g' to generate and exit ]
|
||||
|
||||
|
||||
== AeonWave ===
|
||||
|
||||
For FlightGear AeonWave has a number of advantages over OpenAL:
|
||||
* Correct Doppler effect behavior
|
||||
* Default distance attenuation frequency filtering
|
||||
* Native support for 29 types of audio formats.
|
||||
* Native support for wav, mp3, vorbis and raw file formats.
|
||||
|
||||
The source code of AeonWave can be found on GitHub:
|
||||
https://github.com/adalinbv
|
||||
|
||||
Optimized binary packages are available at:
|
||||
http://www.adalin.com/
|
@ -25,5 +25,6 @@
|
||||
|
||||
#cmakedefine SYSTEM_EXPAT
|
||||
#cmakedefine ENABLE_SOUND
|
||||
#cmakedefine USE_AEONWAVE
|
||||
#cmakedefine ENABLE_SIMD
|
||||
#cmakedefine ENABLE_GDAL
|
||||
|
@ -314,7 +314,7 @@ public:
|
||||
/**
|
||||
* Get a list of available playback devices.
|
||||
*/
|
||||
std::vector<const char*> get_available_devices();
|
||||
std::vector<std::string> get_available_devices();
|
||||
|
||||
/**
|
||||
* Get the current OpenAL vendor or rendering backend.
|
||||
|
@ -75,10 +75,6 @@ public:
|
||||
|
||||
~SoundManagerPrivate()
|
||||
{
|
||||
for (auto it = _devices.begin(); it != _devices.end(); ++it) {
|
||||
free((void*)*it);
|
||||
}
|
||||
_devices.clear();
|
||||
_sample_groups.clear();
|
||||
}
|
||||
|
||||
@ -125,8 +121,6 @@ public:
|
||||
}
|
||||
|
||||
sample_group_map _sample_groups;
|
||||
|
||||
std::vector<const char*> _devices;
|
||||
};
|
||||
|
||||
|
||||
@ -444,7 +438,7 @@ unsigned int SGSoundMgr::request_buffer(SGSoundSample *sample)
|
||||
std::string sample_name = sample->get_sample_name();
|
||||
|
||||
aax::Buffer& buf = d->_aax.buffer(sample_name);
|
||||
if (!buf) {
|
||||
if (sample->is_file() && !buf) {
|
||||
SG_LOG(SG_SOUND, SG_ALERT,
|
||||
"Unable to create buffer: " << sample_name);
|
||||
sample->set_buffer( SGSoundMgr::FAILED_BUFFER );
|
||||
@ -561,6 +555,7 @@ void SGSoundMgr::sample_play( SGSoundSample *sample )
|
||||
if (bufid == SGSoundMgr::FAILED_BUFFER ||
|
||||
bufid == SGSoundMgr::NO_BUFFER)
|
||||
{
|
||||
printf("A: release: %i, bufid: %i (%i, %i)\n", sample->get_source(), bufid, SGSoundMgr::FAILED_BUFFER, SGSoundMgr::NO_BUFFER);
|
||||
release_source(sample->get_source());
|
||||
return;
|
||||
}
|
||||
@ -646,6 +641,8 @@ void SGSoundMgr::update_sample_config( SGSoundSample *sample, SGVec3d& position,
|
||||
aax::Emitter& emitter = d->get_emitter(sample->get_source());
|
||||
aax::dsp dsp;
|
||||
|
||||
if (emitter != d->nullEmitter)
|
||||
{
|
||||
aax::Vector64 pos = position.data();
|
||||
aax::Vector ori = orientation.data();
|
||||
aax::Vector vel = velocity.data();
|
||||
@ -674,11 +671,16 @@ void SGSoundMgr::update_sample_config( SGSoundSample *sample, SGVec3d& position,
|
||||
TRY( dsp.set(AAX_MAX_DISTANCE, sample->get_max_dist()) );
|
||||
TRY( emitter.set(dsp) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
SG_LOG( SG_SOUND, SG_ALERT, "Error: source: " << sample->get_source() << " not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vector<const char*> SGSoundMgr::get_available_devices()
|
||||
vector<std::string> SGSoundMgr::get_available_devices()
|
||||
{
|
||||
vector<std::string> devices;
|
||||
#ifdef ENABLE_SOUND
|
||||
std::string on = " on ";
|
||||
std::string colon = ": ";
|
||||
@ -690,12 +692,12 @@ vector<const char*> SGSoundMgr::get_available_devices()
|
||||
else if (*r) name += on + r;
|
||||
else if (*i) name += colon + i;
|
||||
|
||||
d->_devices.push_back( strdup(name.c_str()) );
|
||||
devices.push_back( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return d->_devices;
|
||||
return devices;
|
||||
}
|
||||
|
||||
|
||||
|
@ -821,9 +821,9 @@ bool SGSoundMgr::load( const std::string &samplepath,
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<const char*> SGSoundMgr::get_available_devices()
|
||||
vector<std::string> SGSoundMgr::get_available_devices()
|
||||
{
|
||||
vector<const char*> devices;
|
||||
vector<std::string> devices;
|
||||
#ifdef ENABLE_SOUND
|
||||
const ALCchar *s;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user