]> git.mxchange.org Git - simgear.git/commitdiff
Add some tests for AeonWave
authorErik Hofman <erik@ehofman.com>
Sun, 17 Jul 2016 08:25:49 +0000 (10:25 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/sound/CMakeLists.txt
simgear/sound/soundmgr_aeonwave.cxx
simgear/sound/soundmgr_aeonwave.hxx

index 88825386a17f82e317ff90566021820fe3dee492..556244dc771c045c5352ea53dafcdfbcfb8da224 100644 (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)
index c79fb32fad06b349d33d8e8b6ddc4d2230ad54d0..48a47ce8c72bc27d54ad2f7a4d136dcd9925901b 100644 (file)
@@ -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<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
index 91fb9b57b1fc3d1589a33722d5f24182260ef570..a680b4463d2efae24b84216ca0645f3a37af7a7f 100644 (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