diff --git a/catkin/CMakeLists.txt b/catkin/CMakeLists.txt index aee6aae..bcfa806 100644 --- a/catkin/CMakeLists.txt +++ b/catkin/CMakeLists.txt @@ -43,6 +43,7 @@ include_directories( ## Declare a cpp library add_library(${PROJECT_NAME} ../${PROJECT_NAME}/debug.cpp + ../${PROJECT_NAME}/river.cpp ../${PROJECT_NAME}/Manager.cpp ../${PROJECT_NAME}/Interface.cpp ../${PROJECT_NAME}/CircularBuffer.cpp diff --git a/test/catkin/CMakeLists.txt b/test/catkin/CMakeLists.txt index 001b4b5..8a0f941 100644 --- a/test/catkin/CMakeLists.txt +++ b/test/catkin/CMakeLists.txt @@ -54,7 +54,3 @@ install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) -install(DIRECTORY ../../data/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} - FILES_MATCHING PATTERN "*.json") - diff --git a/test/testEchoDelay.h b/test/testEchoDelay.h index 1236076..267b7f4 100644 --- a/test/testEchoDelay.h +++ b/test/testEchoDelay.h @@ -49,7 +49,10 @@ namespace river_test_echo_delay { channelMap, audio::format_int16, "speaker"); - EXPECT_NE(m_interfaceOut, nullptr); + if(m_interfaceOut == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded, this, @@ -66,7 +69,10 @@ namespace river_test_echo_delay { channelMap, audio::format_int16, "microphone"); - EXPECT_NE(m_interfaceIn, nullptr); + if(m_interfaceIn == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived, this, @@ -81,7 +87,10 @@ namespace river_test_echo_delay { channelMap, audio::format_int16, "speaker"); - EXPECT_NE(m_interfaceFB, nullptr); + if(m_interfaceFB == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interfaceFB->setInputCallback(std11::bind(&TestClass::onDataReceivedFeedBack, this, @@ -340,6 +349,18 @@ namespace river_test_echo_delay { } } void run() { + if(m_interfaceIn == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } + if(m_interfaceOut == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } + if(m_interfaceFB == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interfaceOut->start(); m_interfaceIn->start(); //m_interfaceFB->start(); diff --git a/test/testFormat.h b/test/testFormat.h index 6c48d7a..c8427f8 100644 --- a/test/testFormat.h +++ b/test/testFormat.h @@ -66,7 +66,10 @@ namespace river_test_format { _format, "speaker", "WriteModeCallbackType"); - EXPECT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interface->setOutputCallback(std11::bind(&testOutCallbackType::onDataNeeded, this, @@ -132,15 +135,15 @@ namespace river_test_format { } } void run() { - if (m_interface != nullptr) { - m_interface->start(); - // wait 2 second ... - usleep(1000000); - m_interface->stop(); - usleep(100000); - } else { - APPL_ERROR("Can not create interface !!!"); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; } + m_interface->start(); + // wait 2 second ... + usleep(1000000); + m_interface->stop(); + usleep(100000); } }; diff --git a/test/testMuxer.h b/test/testMuxer.h index 7911861..228fec5 100644 --- a/test/testMuxer.h +++ b/test/testMuxer.h @@ -30,7 +30,10 @@ namespace river_test_muxer { channelMap, audio::format_int16, "speaker"); - EXPECT_NE(m_interfaceOut, nullptr); + if(m_interfaceOut == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded, this, @@ -48,7 +51,10 @@ namespace river_test_muxer { std::vector(), audio::format_int16, "microphone-muxed"); - EXPECT_NE(m_interfaceIn, nullptr); + if(m_interfaceIn == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived, this, @@ -92,6 +98,14 @@ namespace river_test_muxer { APPL_ERROR("Receive data ... " << _nbChunk << " map=" << _map); } void run() { + if(m_interfaceIn == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } + if(m_interfaceOut == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interfaceOut->start(); m_interfaceIn->start(); usleep(10000000); diff --git a/test/testPlaybackCallback.h b/test/testPlaybackCallback.h index 65986d1..d4f3569 100644 --- a/test/testPlaybackCallback.h +++ b/test/testPlaybackCallback.h @@ -29,7 +29,10 @@ namespace river_test_playback_callback { channelMap, audio::format_int16, _io); - ASSERT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interface->setOutputCallback(std11::bind(&testOutCallback::onDataNeeded, this, @@ -62,7 +65,10 @@ namespace river_test_playback_callback { } } void run() { - ASSERT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->start(); // wait 2 second ... usleep(2000000); diff --git a/test/testPlaybackWrite.h b/test/testPlaybackWrite.h index 66117dd..a4ef4c0 100644 --- a/test/testPlaybackWrite.h +++ b/test/testPlaybackWrite.h @@ -28,7 +28,7 @@ namespace river_test_playback_write { "}\n"; class testOutWrite { - private: + public: std::vector m_channelMap; std11::shared_ptr m_manager; std11::shared_ptr m_interface; @@ -42,10 +42,17 @@ namespace river_test_playback_write { m_channelMap, audio::format_int16, "speaker"); - EXPECT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->setReadwrite(); } void run() { + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } double phase=0; std::vector data; data.resize(1024*m_channelMap.size()); @@ -96,7 +103,7 @@ namespace river_test_playback_write { } class testOutWriteCallback { - private: + public: std11::shared_ptr m_manager; std11::shared_ptr m_interface; double m_phase; @@ -112,6 +119,10 @@ namespace river_test_playback_write { channelMap, audio::format_int16, "speaker"); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->setReadwrite(); m_interface->setWriteCallback(std11::bind(&testOutWriteCallback::onDataNeeded, this, @@ -145,6 +156,10 @@ namespace river_test_playback_write { m_interface->write(&data[0], data.size()/_map.size()); } void run() { + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->start(); usleep(1000000); m_interface->stop(); diff --git a/test/testRecordCallback.h b/test/testRecordCallback.h index 5429457..2ab602a 100644 --- a/test/testRecordCallback.h +++ b/test/testRecordCallback.h @@ -29,7 +29,7 @@ namespace river_test_record_callback { "}\n"; class testInCallback { - private: + public: std11::shared_ptr m_manager; std11::shared_ptr m_interface; public: @@ -41,7 +41,10 @@ namespace river_test_record_callback { channelMap, audio::format_int16, _input); - EXPECT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interface->setInputCallback(std11::bind(&testInCallback::onDataReceived, this, @@ -71,6 +74,10 @@ namespace river_test_record_callback { APPL_INFO("Get data ... average=" << int32_t(value)); } void run() { + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->start(); // wait 2 second ... usleep(20000000); diff --git a/test/testVolume.h b/test/testVolume.h index 5c07acf..198cc5a 100644 --- a/test/testVolume.h +++ b/test/testVolume.h @@ -44,7 +44,10 @@ namespace river_test_volume { channelMap, audio::format_int16, "speaker"); - EXPECT_NE(m_interface, nullptr); + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } // set callback mode ... m_interface->setOutputCallback(std11::bind(&testCallbackVolume::onDataNeeded, this, @@ -76,6 +79,10 @@ namespace river_test_volume { } } void run() { + if(m_interface == nullptr) { + APPL_ERROR("nullptr interface"); + return; + } m_interface->start(); usleep(1000000); m_interface->setParameter("volume", "FLOW", "-3dB");