From: Erik Hofman Date: Sun, 17 Jul 2016 08:25:49 +0000 (+0200) Subject: Add some tests for AeonWave X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=62524e0280b4a64b6820d362be453a0fbc05df2b;p=simgear.git Add some tests for AeonWave --- diff --git a/simgear/sound/CMakeLists.txt b/simgear/sound/CMakeLists.txt index 88825386..556244dc 100644 --- a/simgear/sound/CMakeLists.txt +++ b/simgear/sound/CMakeLists.txt @@ -35,12 +35,28 @@ endif() simgear_scene_component(sound sound "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS AND ENABLE_SOUND) + function(create_test TEST_NAME) + add_executable(${TEST_NAME} ${TEST_NAME}.cxx) + target_link_libraries(${TEST_NAME} ${SOUND_TEST_LIBS}) + set_target_properties(${TEST_NAME} PROPERTIES + COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) + endfunction() set( SOUND_TEST_LIBS ${TEST_LIBS} ) if (USE_AEONWAVE) + if (SIMGEAR_SHARED) + else() + set(SOUND_TEST_LIBS ${SOUND_TEST_LIBS} + ${AAX_LIBRARY} + ) + endif() + + create_test(aeonwave_test1) + create_test(aeonwave_test2) + else () if (SIMGEAR_SHARED) else() @@ -49,13 +65,6 @@ if(ENABLE_TESTS AND ENABLE_SOUND) ) endif() - function(create_test TEST_NAME) - add_executable(${TEST_NAME} ${TEST_NAME}.cxx) - target_link_libraries(${TEST_NAME} ${SOUND_TEST_LIBS}) - set_target_properties(${TEST_NAME} PROPERTIES - COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) - endfunction() - create_test(openal_test1) create_test(openal_test2) create_test(openal_test3) diff --git a/simgear/sound/soundmgr_aeonwave.cxx b/simgear/sound/soundmgr_aeonwave.cxx index c79fb32f..48a47ce8 100644 --- a/simgear/sound/soundmgr_aeonwave.cxx +++ b/simgear/sound/soundmgr_aeonwave.cxx @@ -178,26 +178,29 @@ void SGSoundMgr::init() d->init(); - d->_aax.set(AAX_INITIALIZED); - testForError("initialization"); - - dsp = AAX::DSP(d->_aax, AAX_VOLUME_FILTER); - dsp.set(AAX_GAIN, 0.0f); - d->_aax.set(dsp); + if ( is_working() ) + { + d->_aax.set(AAX_INITIALIZED); + testForError("initialization"); - dsp = AAX::DSP(d->_aax, AAX_DISTANCE_FILTER); - dsp.set(AAX_AL_INVERSE_DISTANCE_CLAMPED); - d->_aax.set(dsp); + dsp = AAX::DSP(d->_aax, AAX_VOLUME_FILTER); + dsp.set(AAX_GAIN, 0.0f); + d->_aax.set(dsp); - dsp = AAX::DSP(d->_aax, AAX_VELOCITY_EFFECT); - dsp.set(AAX_DOPPLER_FACTOR, 1.0f); - dsp.set(AAX_SOUND_VELOCITY, 340.3f); - d->_aax.set(dsp); + dsp = AAX::DSP(d->_aax, AAX_DISTANCE_FILTER); + dsp.set(AAX_AL_INVERSE_DISTANCE_CLAMPED); + d->_aax.set(dsp); - testForError("scenery setup"); + dsp = AAX::DSP(d->_aax, AAX_VELOCITY_EFFECT); + dsp.set(AAX_DOPPLER_FACTOR, 1.0f); + dsp.set(AAX_SOUND_VELOCITY, 340.3f); + d->_aax.set(dsp); + testForError("scenery setup"); - _vendor = (const char *)d->_aax.info(AAX_VENDOR_STRING); - _renderer = (const char *)d->_aax.info(AAX_RENDERER_STRING); + _vendor = (const char *)d->_aax.info(AAX_VENDOR_STRING); + _renderer = (const char *)d->_aax.info(AAX_RENDERER_STRING); + } + testForError("init"); #endif } @@ -295,7 +298,7 @@ void SGSoundMgr::resume() void SGSoundMgr::update( double dt ) { #ifdef ENABLE_SOUND - if (_active) { + if ( is_working() && _active ) { if (_changed) { d->update_pos_and_orientation(); } @@ -655,9 +658,9 @@ vector SGSoundMgr::get_available_devices() while (const char* r = d->_aax.devices()) { while (const char* i = d->_aax.interfaces()) { std::string name = be; - if (i && r) name += on + r + colon + i; - else if (r) name += on + r; - else if (i) name += colon + i; + if (*i && *r) name += on + r + colon + i; + else if (*r) name += on + r; + else if (*i) name += colon + i; d->_devices.push_back( strdup(name.c_str()) ); } @@ -693,7 +696,7 @@ bool SGSoundMgr::testForError(std::string s, std::string name) bool SGSoundMgr::is_working() const { - return (d->_aax != NULL); + return ((const void*)d->_aax != NULL ? true : false); } const SGQuatd& SGSoundMgr::get_orientation() const diff --git a/simgear/sound/soundmgr_aeonwave.hxx b/simgear/sound/soundmgr_aeonwave.hxx index 91fb9b57..a680b446 100644 --- a/simgear/sound/soundmgr_aeonwave.hxx +++ b/simgear/sound/soundmgr_aeonwave.hxx @@ -154,7 +154,7 @@ public: * * @return Velocity vector of the OpenAL listener */ - inline SGVec3f get_velocity() { SGVec3f f(_velocity); return f; } + inline SGVec3f get_velocity() { SGVec3d f(_velocity); return toVec3f(f); } /** * Set the orientation of the sound manager