From c03359a18962ff92e3edccd5d07fcafa05906688 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Tue, 31 Oct 2017 10:42:44 +0100 Subject: [PATCH] Update to the (now GPL) AeonWave version 3.0+ --- CMakeModules/FindAAX.cmake | 21 +++++++++++++++++---- SimGearConfig.cmake.in | 1 + simgear/sound/CMakeLists.txt | 10 +++++++--- simgear/sound/aeonwave_test1.cxx | 12 ++++++------ simgear/sound/soundmgr_aeonwave.cxx | 19 ++++++++++--------- 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/CMakeModules/FindAAX.cmake b/CMakeModules/FindAAX.cmake index d9a5e00b..4e0bfdcd 100644 --- a/CMakeModules/FindAAX.cmake +++ b/CMakeModules/FindAAX.cmake @@ -10,12 +10,13 @@ # # Created by Erik Hofman. -FIND_PATH(AAX_INCLUDE_DIR aax/aeonwave.hpp +FIND_PATH(AAX_INCLUDE_DIR aax/aax.h HINTS $ENV{AAXDIR} $ENV{ProgramFiles}/aax $ENV{ProgramFiles}/AeonWave $ENV{ProgramFiles}/Adalin/AeonWave + ${CMAKE_SOURCE_DIR}/aax PATH_SUFFIXES include PATHS ~/Library/Frameworks @@ -26,23 +27,35 @@ FIND_PATH(AAX_INCLUDE_DIR aax/aeonwave.hpp ) FIND_LIBRARY(AAX_LIBRARY - NAMES AAX aax AAX32 libAAX32 + NAMES AAX aax AAX32 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 PATHS ~/Library/Frameworks /Library/Frameworks + /usr/local /usr /opt - /usr/local ) -SET(AAX_FOUND "NO") IF(AAX_LIBRARY AND AAX_INCLUDE_DIR) SET(AAX_FOUND "YES") +ELSE(AAX_LIBRARY AND AAX_INCLUDE_DIR) + IF(NOT AAX_INCLUDE_DIR) + MESSAGE(FATAL_ERROR "Unable to find the AAX library development files.") + SET(AAX_FOUND "NO") + ENDIF(NOT AAX_INCLUDE_DIR) + IF(NOT AAX_LIBRARY) + IF(SINGLE_PACKAGE) + SET(AAX_LIBRARY "${aax_BUILD_DIR}/aax/AAX32.dll") + SET(AAX_FOUND "YES") + ELSE(SINGLE_PACKAGE) + ENDIF(SINGLE_PACKAGE) + ENDIF(NOT AAX_LIBRARY) ENDIF(AAX_LIBRARY AND AAX_INCLUDE_DIR) diff --git a/SimGearConfig.cmake.in b/SimGearConfig.cmake.in index 8e93ad48..71be04cd 100644 --- a/SimGearConfig.cmake.in +++ b/SimGearConfig.cmake.in @@ -7,6 +7,7 @@ find_dependency(Threads) set(SIMGEAR_HEADLESS @SIMGEAR_HEADLESS@) set(SIMGEAR_SOUND @ENABLE_SOUND@) +set(USE_AEONWAVE @USE_AEONWAVE@) # OpenAL isn't a public dependency, so maybe not needed #if (SIMGEAR_SOUND) diff --git a/simgear/sound/CMakeLists.txt b/simgear/sound/CMakeLists.txt index 4c4408e5..b284d736 100644 --- a/simgear/sound/CMakeLists.txt +++ b/simgear/sound/CMakeLists.txt @@ -4,16 +4,15 @@ set(HEADERS sample.hxx sample_group.hxx xmlsound.hxx - readwav.hxx soundmgr.hxx + filters.hxx ) set(SOURCES sample.cxx sample_group.cxx xmlsound.cxx - readwav.cxx - soundmgr_openal_private.hxx + filters.cxx ) if (USE_AEONWAVE) @@ -21,8 +20,13 @@ if (USE_AEONWAVE) soundmgr_aeonwave.cxx ) else() + set(HEADERS ${HEADERS} + readwav.hxx + ) set(SOURCES ${SOURCES} soundmgr_openal.cxx + soundmgr_openal_private.hxx + readwav.cxx ) endif() diff --git a/simgear/sound/aeonwave_test1.cxx b/simgear/sound/aeonwave_test1.cxx index 1e0baa0d..fca3777c 100644 --- a/simgear/sound/aeonwave_test1.cxx +++ b/simgear/sound/aeonwave_test1.cxx @@ -66,15 +66,15 @@ int main( int argc, char *argv[] ) std::cout << "Vendor: " << _vendor << std::endl; std::cout << "Renderer: " << _renderer << std::endl; - aax::Matrix64 mtx64; - mtx64.translate(-5000.0, 12500.0, 1000.0); + aax::Matrix mtx; + mtx.translate(-5000.0, 12500.0, 1000.0); - aax::Matrix mtx = mtx64.toMatrix(); - emitter.matrix(mtx); + aax::Matrix64 mtx64 = mtx.toMatrix64(); + emitter.matrix(mtx64); mtx.translate(-5.0, 2.0, 1.0); - mtx.inverse(); - aax.sensor_matrix(mtx); + mtx64.inverse(); + aax.sensor_matrix(mtx64); aax.set(AAX_PLAYING); emitter.set(AAX_PLAYING); diff --git a/simgear/sound/soundmgr_aeonwave.cxx b/simgear/sound/soundmgr_aeonwave.cxx index 1ae801a5..0ba9d33b 100644 --- a/simgear/sound/soundmgr_aeonwave.cxx +++ b/simgear/sound/soundmgr_aeonwave.cxx @@ -92,14 +92,14 @@ public: } void init() { - _mtx = aax::Matrix(); + _mtx = aax::Matrix64(); } void update_pos_and_orientation() { SGVec3d sgv_at = _orientation.backTransform(-SGVec3d::e3()); SGVec3d sgv_up = _orientation.backTransform(SGVec3d::e2()); - SGVec3f pos = SGVec3f::zeros(); + SGVec3d pos = SGVec3d::zeros(); _mtx.set(pos.data(), toVec3f(sgv_at).data(), toVec3f(sgv_up).data()); @@ -107,7 +107,7 @@ public: } aax::AeonWave _aax; - aax::Matrix _mtx; + aax::Matrix64 _mtx; SGVec3d _absolute_pos; SGVec3d _base_pos; @@ -338,7 +338,7 @@ void SGSoundMgr::update( double dt ) TRY( dsp.set(AAX_SOUND_VELOCITY, 340.3f) ); TRY( d->_aax.set(dsp) ); #endif - aax::Matrix mtx = d->_mtx; + aax::Matrix64 mtx = d->_mtx; mtx.inverse(); TRY( d->_aax.sensor_matrix(mtx) ); @@ -465,7 +465,7 @@ unsigned int SGSoundMgr::request_buffer(SGSoundSample *sample) } bufid = d->_buffer_id++; - d->_buffers.insert( std::make_pair(bufid,buf) ); + d->_buffers.insert( {bufid, buf} ); if ( !sample->is_file() ) { enum aaxFormat format = AAX_FORMAT_NONE; @@ -493,7 +493,7 @@ unsigned int SGSoundMgr::request_buffer(SGSoundSample *sample) unsigned int no_samples = sample->get_no_samples(); unsigned int no_tracks = sample->get_no_tracks(); unsigned int frequency = sample->get_frequency(); - TRY( buf.set(d->_aax, no_samples, no_tracks, format) ); + buf.set(d->_aax, no_samples, no_tracks, format); TRY( buf.set(AAX_FREQUENCY, frequency) ); TRY( buf.fill(sample->get_data()) ); @@ -659,11 +659,11 @@ void SGSoundMgr::update_sample_config( SGSoundSample *sample, SGVec3d& position, aax::Emitter& emitter = d->get_emitter(sample->get_source()); aax::dsp dsp; - aax::Vector pos = toVec3f(position).data(); + aax::Vector64 pos = position.data(); aax::Vector ori = orientation.data(); aax::Vector vel = velocity.data(); - aax::Matrix mtx(pos, ori); + aax::Matrix64 mtx(pos, ori); TRY( emitter.matrix(mtx) ); TRY( emitter.velocity(vel) ); @@ -763,7 +763,8 @@ void SGSoundMgr::set_position( const SGVec3d& pos, const SGGeod& pos_geod ) SGVec3f SGSoundMgr::get_direction() const { - aaxVec3f pos, at, up; + aaxVec3f at, up; + aaxVec3d pos; d->_mtx.get(pos, at, up); return SGVec3f( at ); }