Add some tests for AeonWave

This commit is contained in:
Erik Hofman 2016-07-17 10:25:49 +02:00
parent 488039d1de
commit 0b60669075
3 changed files with 41 additions and 29 deletions

View File

@ -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)

View File

@ -178,26 +178,29 @@ void SGSoundMgr::init()
d->init();
d->_aax.set(AAX_INITIALIZED);
testForError("initialization");
if ( is_working() )
{
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);
dsp = AAX::DSP(d->_aax, AAX_VOLUME_FILTER);
dsp.set(AAX_GAIN, 0.0f);
d->_aax.set(dsp);
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_DISTANCE_FILTER);
dsp.set(AAX_AL_INVERSE_DISTANCE_CLAMPED);
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_VELOCITY_EFFECT);
dsp.set(AAX_DOPPLER_FACTOR, 1.0f);
dsp.set(AAX_SOUND_VELOCITY, 340.3f);
d->_aax.set(dsp);
testForError("scenery setup");
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<const char*> 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

View File

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