1
0
Fork 0

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:
Erik Hofman 2018-06-02 14:06:36 +02:00
parent 100155e37e
commit 2edf1443d3
7 changed files with 59 additions and 36 deletions

View file

@ -199,7 +199,6 @@ option(ENABLE_PROFILE "Set to ON to build FlightGear with gperftools profilin
option(SYSTEM_SQLITE "Set to ON to build FlightGear with the system's SQLite3 library" OFF)
option(ENABLE_IAX "Set to ON to build FlightGear with IAXClient/fgcom built-in (default)" ON)
option(USE_DBUS "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT})
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" OFF)
option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex and speexdsp library" ${SYSTEM_SPEEX_DEFAULT})
option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT})
option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT})
@ -520,7 +519,7 @@ include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${SQLITE3_INCLUDED_DIR} )
if (USE_AEONWAVE)
find_package(AAX COMPONENTS aax REQUIRED)
find_package(AAX REQUIRED)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${AAX_INCLUDE_DIR}
)

View file

@ -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
@ -27,14 +32,14 @@ FIND_PATH(AAX_INCLUDE_DIR aax/aax.h
)
FIND_LIBRARY(AAX_LIBRARY
NAMES AAX aax AAX32
NAMES AAX aax libAAX
HINTS
$ENV{AAXDIR}
$ENV{ProgramFiles}/AAX
$ENV{ProgramFiles}/AeonWave
$ENV{ProgramFiles}/Adalin/AeonWave
${CMAKE_BUILD_DIR}/aax
PATH_SUFFIXES bin lib lib/${CMAKE_LIBRARY_ARCHITECTURE} lib64 libs64 libs libs/Win32 libs/Win64
PATH_SUFFIXES lib64 lib lib/${CMAKE_LIBRARY_ARCHITECTURE} libs64 libs libs/Win32 libs/Win64 bin
PATHS
~/Library/Frameworks
/Library/Frameworks
@ -52,7 +57,7 @@ ELSE(AAX_LIBRARY AND AAX_INCLUDE_DIR)
ENDIF(NOT AAX_INCLUDE_DIR)
IF(NOT AAX_LIBRARY)
IF(SINGLE_PACKAGE)
SET(AAX_LIBRARY "${aax_BUILD_DIR}/aax/AAX32.dll")
SET(AAX_LIBRARY "${aax_BUILD_DIR}/aax/AAX.lib")
SET(AAX_FOUND "YES")
ELSE(SINGLE_PACKAGE)
ENDIF(SINGLE_PACKAGE)

View file

@ -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
View 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/

View file

@ -2263,8 +2263,8 @@ void Options::processArgResult(int result)
cout << renderer << " provided by " << vendor << endl;
cout << endl << "No. Device" << endl;
vector <const char*>devices = smgr.get_available_devices();
for (vector <const char*>::size_type i=0; i<devices.size(); i++) {
vector <std::string>devices = smgr.get_available_devices();
for (vector <std::string>::size_type i=0; i<devices.size(); i++) {
cout << i << ". \"" << devices[i] << "\"" << endl;
}
devices.clear();

View file

@ -142,10 +142,10 @@ void FGSoundManager::activate(bool State)
void FGSoundManager::update_device_list()
{
std::vector <const char*>devices = get_available_devices();
std::vector <std::string>devices = get_available_devices();
for (unsigned int i=0; i<devices.size(); i++) {
SGPropertyNode *p = fgGetNode("/sim/sound/devices/device", i, true);
p->setStringValue(devices[i]);
p->setStringValue(devices[i].c_str());
}
devices.clear();
}

View file

@ -50,8 +50,8 @@ bool SGSoundMgr::load(const std::string &samplepath, void **data, int *format, s
return false;
}
std::vector<const char*> SGSoundMgr::get_available_devices()
std::vector<std::string> SGSoundMgr::get_available_devices()
{
std::vector<const char*> result;
std::vector<std::string> result;
return result;
}