From 5e89ae6bfa4cb32a0c33c3447f8b201b3d593ba6 Mon Sep 17 00:00:00 2001 From: designe Date: Mon, 13 Sep 2021 20:57:54 +0900 Subject: [PATCH] Added Unit-test(packetWithFSKTest, waveRenderTest) on CMakeLists.txt > minor refactoring on TxEngine --- euphony/src/main/cpp/core/source/TxEngine.cpp | 10 ++++++---- euphony/src/main/cpp/tests/CMakeLists.txt | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/euphony/src/main/cpp/core/source/TxEngine.cpp b/euphony/src/main/cpp/core/source/TxEngine.cpp index b099497..675ea84 100644 --- a/euphony/src/main/cpp/core/source/TxEngine.cpp +++ b/euphony/src/main/cpp/core/source/TxEngine.cpp @@ -21,7 +21,7 @@ class TxEngine::TxEngineImpl : public IRestartable{ std::shared_ptr mStream; oboe::AudioStreamBuilder mStreamBuilder; std::unique_ptr mCallback; - shared_ptr mAudioSource = nullptr; + std::shared_ptr mAudioSource = nullptr; bool mIsLatencyDetectionSupported = false; double eupiFreq; @@ -71,9 +71,7 @@ class TxEngine::TxEngineImpl : public IRestartable{ return std::make_shared(modulationResult, kChannelCount); } case ModeType::EUPI: - mAudioSource = std::make_shared(kSampleRate, kChannelCount); - std::dynamic_pointer_cast(mAudioSource)->setFrequency(eupiFreq); - return mAudioSource; + return std::make_shared(kSampleRate, kChannelCount); } } @@ -159,10 +157,14 @@ class TxEngine::TxEngineImpl : public IRestartable{ mModeType = ModeType::DEFAULT; break; case 1: + if(mModeType == ModeType::EUPI) + return; + mModeType = ModeType::EUPI; break; } + mAudioSource = createAudioSource(mModeType); } diff --git a/euphony/src/main/cpp/tests/CMakeLists.txt b/euphony/src/main/cpp/tests/CMakeLists.txt index f870510..d5c9eba 100644 --- a/euphony/src/main/cpp/tests/CMakeLists.txt +++ b/euphony/src/main/cpp/tests/CMakeLists.txt @@ -20,8 +20,10 @@ add_executable( packetTest.cpp packetBuilderTest.cpp packetErrorDetectorTest.cpp + packetWithFSKTest.cpp waveTest.cpp waveBuilderTest.cpp + waveRendererTest.cpp ) target_link_libraries(${TEST_EUPHONY} PUBLIC euphony gtest)